diff options
author | Andrey Andreev <narf@bofh.bg> | 2012-03-29 10:30:33 +0200 |
---|---|---|
committer | Andrey Andreev <narf@bofh.bg> | 2012-03-29 10:30:33 +0200 |
commit | 22b9e5f5a2a95b5ab0e77423c8807318b8c4b030 (patch) | |
tree | 6d6fe4ff9e3ba44be0f4ac2a583f00c3d0af1822 /system/database/drivers/postgre | |
parent | da44bacbad76b9a898accdd533b48c04c6b0b12f (diff) |
Minor improvements to PostgreSQL and SQLite result classes
Diffstat (limited to 'system/database/drivers/postgre')
-rw-r--r-- | system/database/drivers/postgre/postgre_result.php | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/system/database/drivers/postgre/postgre_result.php b/system/database/drivers/postgre/postgre_result.php index 8b22564b3..394b8b6fd 100644 --- a/system/database/drivers/postgre/postgre_result.php +++ b/system/database/drivers/postgre/postgre_result.php @@ -70,7 +70,7 @@ class CI_DB_postgre_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[] = pg_field_name($this->result_id, $i); } @@ -90,16 +90,14 @@ class CI_DB_postgre_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 = pg_field_name($this->result_id, $i); - $F->type = pg_field_type($this->result_id, $i); - $F->max_length = pg_field_size($this->result_id, $i); - $F->primary_key = 0; - $F->default = ''; - - $retval[] = $F; + $retval[$i] = new stdClass(); + $retval[$i]->name = pg_field_name($this->result_id, $i); + $retval[$i]->type = pg_field_type($this->result_id, $i); + $retval[$i]->max_length = pg_field_size($this->result_id, $i); + $retval[$i]->primary_key = 0; + $retval[$i]->default = ''; } return $retval; |