diff options
author | Andrey Andreev <narf@bofh.bg> | 2012-03-02 12:47:16 +0100 |
---|---|---|
committer | Andrey Andreev <narf@bofh.bg> | 2012-03-02 12:47:16 +0100 |
commit | c8b3ac4fa57fed397b6d1085f8ff99c25c7a9221 (patch) | |
tree | 32687bedd72fc8ff664aa16b59d714867bba5141 /system/database/drivers/mysqli | |
parent | f4ec1f21d5d53ce7c2a1076ca8fd3ab2e6223a6e (diff) | |
parent | 8f22057724dd8fe2b9d41ba98bfc4da282572c5e (diff) |
Merge branch 'develop' of github.com:EllisLab/CodeIgniter into develop-db-sqlite
Diffstat (limited to 'system/database/drivers/mysqli')
-rw-r--r-- | system/database/drivers/mysqli/mysqli_result.php | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/system/database/drivers/mysqli/mysqli_result.php b/system/database/drivers/mysqli/mysqli_result.php index 0a50cccac..8b909cc56 100644 --- a/system/database/drivers/mysqli/mysqli_result.php +++ b/system/database/drivers/mysqli/mysqli_result.php @@ -90,18 +90,15 @@ class CI_DB_mysqli_result extends CI_DB_result { public function field_data() { $retval = array(); - while ($field = mysqli_fetch_object($this->result_id)) + $field_data = mysqli_fetch_fields($this->result_id); + for ($i = 0, $c = count($field_data); $i < $c; $i++) { - preg_match('/([a-zA-Z]+)(\(\d+\))?/', $field->Type, $matches); - - $F = new stdClass(); - $F->name = $field->Field; - $F->type = ( ! empty($matches[1])) ? $matches[1] : NULL; - $F->default = $field->Default; - $F->max_length = ( ! empty($matches[2])) ? preg_replace('/[^\d]/', '', $matches[2]) : NULL; - $F->primary_key = (int) ($field->Key === 'PRI'); - - $retval[] = $F; + $retval[$i] = new stdClass(); + $retval[$i]->name = $field_data[$i]->name; + $retval[$i]->type = $field_data[$i]->type; + $retval[$i]->max_length = $field_data[$i]->max_length; + $retval[$i]->primary_key = (int) ($field_data[$i]->flags & 2); + $retval[$i]->default = ''; } return $retval; |