diff options
author | Andrey Andreev <narf@bofh.bg> | 2012-04-02 10:14:04 +0200 |
---|---|---|
committer | Andrey Andreev <narf@bofh.bg> | 2012-04-02 10:14:04 +0200 |
commit | a9572fa67e4778f7d0a42898c603fddcb64660f8 (patch) | |
tree | 48a7785021377dd3e7f8fcd3ff41f3cf650c327b /system/database/drivers/sqlite/sqlite_result.php | |
parent | 2efd029d012fedd421540d14b8a5759032c0b5c6 (diff) | |
parent | d3891f4f50e3cb3cfd1b6491088d759d586e2302 (diff) |
Merge upstream branch
Diffstat (limited to 'system/database/drivers/sqlite/sqlite_result.php')
-rw-r--r-- | system/database/drivers/sqlite/sqlite_result.php | 46 |
1 files changed, 12 insertions, 34 deletions
diff --git a/system/database/drivers/sqlite/sqlite_result.php b/system/database/drivers/sqlite/sqlite_result.php index b002aeff1..4af80abf7 100644 --- a/system/database/drivers/sqlite/sqlite_result.php +++ b/system/database/drivers/sqlite/sqlite_result.php @@ -70,9 +70,9 @@ class CI_DB_sqlite_result extends CI_DB_result { public function list_fields() { $field_names = array(); - for ($i = 0; $i < $this->num_fields(); $i++) + for ($i = 0, $c = $this->num_fields(); $i < $c; $i++) { - $field_names[] = sqlite_field_name($this->result_id, $i); + $field_names[$i] = sqlite_field_name($this->result_id, $i); } return $field_names; @@ -90,16 +90,14 @@ class CI_DB_sqlite_result extends CI_DB_result { public function field_data() { $retval = array(); - for ($i = 0; $i < $this->num_fields(); $i++) + for ($i = 0, $c = $this->num_fields(); $i < $c; $i++) { - $F = new stdClass(); - $F->name = sqlite_field_name($this->result_id, $i); - $F->type = 'varchar'; - $F->max_length = 0; - $F->primary_key = 0; - $F->default = ''; - - $retval[] = $F; + $retval[$i] = new stdClass(); + $retval[$i]->name = sqlite_field_name($this->result_id, $i); + $retval[$i]->type = 'varchar'; + $retval[$i]->max_length = 0; + $retval[$i]->primary_key = 0; + $retval[$i]->default = ''; } return $retval; @@ -108,18 +106,6 @@ class CI_DB_sqlite_result extends CI_DB_result { // -------------------------------------------------------------------- /** - * Free the result - * - * @return void - */ - public function free_result() - { - // Not implemented in SQLite - } - - // -------------------------------------------------------------------- - - /** * Data Seek * * Moves the internal pointer to the desired offset. We call @@ -162,17 +148,9 @@ class CI_DB_sqlite_result extends CI_DB_result { { return sqlite_fetch_object($this->result_id); } - else - { - $arr = sqlite_fetch_array($this->result_id, SQLITE_ASSOC); - if (is_array($arr)) - { - $obj = (object) $arr; - return $obj; - } else { - return NULL; - } - } + + $arr = sqlite_fetch_array($this->result_id, SQLITE_ASSOC); + return is_array($arr) ? (object) $arr : FALSE; } } |