diff options
author | Ahmad Anbar <aanbar@gmail.com> | 2015-05-17 12:20:34 +0200 |
---|---|---|
committer | Ahmad Anbar <aanbar@gmail.com> | 2015-05-17 12:20:34 +0200 |
commit | 57940dedcaab05f2dc392b2757cb3d58c59274c9 (patch) | |
tree | 1783dc5a17cc20ddede409e13984576bff274302 /system/database/drivers/sqlite3/sqlite3_driver.php | |
parent | 5e50c42ef27261bc7fcb279499ce76cfc2519aa6 (diff) | |
parent | 3a9eb39f61b10b3f86e50f4cd39ca0d9f010bac2 (diff) |
Merge remote-tracking branch 'upstream/develop' into develop
Diffstat (limited to 'system/database/drivers/sqlite3/sqlite3_driver.php')
-rw-r--r-- | system/database/drivers/sqlite3/sqlite3_driver.php | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/system/database/drivers/sqlite3/sqlite3_driver.php b/system/database/drivers/sqlite3/sqlite3_driver.php index fdbe94939..a7c6420bb 100644 --- a/system/database/drivers/sqlite3/sqlite3_driver.php +++ b/system/database/drivers/sqlite3/sqlite3_driver.php @@ -247,17 +247,31 @@ class CI_DB_sqlite3_driver extends CI_DB { // -------------------------------------------------------------------- /** - * Show column query + * Fetch Field Names * - * Generates a platform-specific query string so that the column names can be fetched - * - * @param string $table - * @return string + * @param string $table Table name + * @return array */ - protected function _list_columns($table = '') + public function list_fields($table) { - // Not supported - return FALSE; + // Is there a cached result? + if (isset($this->data_cache['field_names'][$table])) + { + return $this->data_cache['field_names'][$table]; + } + + if (($result = $this->query('PRAGMA TABLE_INFO('.$this->protect_identifiers($table, TRUE, NULL, FALSE).')')) === FALSE) + { + return FALSE; + } + + $this->data_cache['field_names'][$table] = array(); + foreach ($result as $row) + { + $this->data_cache['field_names'][$table][] = $row['name']; + } + + return $this->data_cache['field_names'][$table]; } // -------------------------------------------------------------------- |