diff options
author | Andrey Andreev <narf@bofh.bg> | 2012-11-16 01:33:30 +0100 |
---|---|---|
committer | Andrey Andreev <narf@bofh.bg> | 2012-11-16 01:33:30 +0100 |
commit | 822e74ee39fffd2c35477be2bedfb37e78eb3bc1 (patch) | |
tree | 27c58f643572474064e6f0d0b0fef4f0b93f04d0 /system/database/drivers/sqlite3/sqlite3_result.php | |
parent | 02e7a9d6509092315dd31183762616860ebb9621 (diff) |
Improve DB field_data() for SQLite
Diffstat (limited to 'system/database/drivers/sqlite3/sqlite3_result.php')
-rw-r--r-- | system/database/drivers/sqlite3/sqlite3_result.php | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/system/database/drivers/sqlite3/sqlite3_result.php b/system/database/drivers/sqlite3/sqlite3_result.php index 153e3480a..44fef8909 100644 --- a/system/database/drivers/sqlite3/sqlite3_result.php +++ b/system/database/drivers/sqlite3/sqlite3_result.php @@ -79,15 +79,24 @@ class CI_DB_sqlite3_result extends CI_DB_result { */ public function field_data() { + static $data_types = array( + SQLITE3_INTEGER => 'integer', + SQLITE3_FLOAT => 'float', + SQLITE3_TEXT => 'text', + SQLITE3_BLOB => 'blob', + SQLITE3_NULL => 'null' + ); + $retval = array(); for ($i = 0, $c = $this->num_fields(); $i < $this->num_fields(); $i++) { $retval[$i] = new stdClass(); $retval[$i]->name = $this->result_id->columnName($i); - $retval[$i]->type = 'varchar'; - $retval[$i]->max_length = 0; - $retval[$i]->primary_key = 0; - $retval[$i]->default = ''; + + $type = $this->result_id->columnType($i); + $retval[$i]->type = isset($data_types[$type]) ? $data_types[$type] : $type; + + $retval[$i]->max_length = NULL; } return $retval; |