diff options
author | Tim Nolte <noltet@sekisui-spi.com> | 2015-06-08 18:25:34 +0200 |
---|---|---|
committer | Tim Nolte <noltet@sekisui-spi.com> | 2015-06-08 18:25:34 +0200 |
commit | 89ed9fafd75e3b65a7691f1b13440bdedadf5eda (patch) | |
tree | 5dfa69c55ff48502527fcb6f4f532fb5ad6651ca /system/database/drivers/sqlite3 | |
parent | 2ac4177b4b6afc63d594523416c3991d23dddf20 (diff) | |
parent | b76394834a3e36e8c376913cd9666a8d7a4cea45 (diff) |
Merge branch 'develop' into feature/mysqli-ssl
Diffstat (limited to 'system/database/drivers/sqlite3')
-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]; } // -------------------------------------------------------------------- |