summaryrefslogtreecommitdiffstats
path: root/system/database/drivers/mysqli/mysqli_result.php
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-03-09 13:35:06 +0100
committerAndrey Andreev <narf@bofh.bg>2012-03-09 13:35:06 +0100
commit56c879a870600b3e3ffce586c849d53e85f93674 (patch)
tree257ef7450d4f020d0db04e1481b59b89796434aa /system/database/drivers/mysqli/mysqli_result.php
parentd9170ad478690260f1b8dce17c82d4c7dc271902 (diff)
parentc016a1102e2a77e0c27b9656c19a0460df24dfb6 (diff)
Merge upstream branch
Diffstat (limited to 'system/database/drivers/mysqli/mysqli_result.php')
-rw-r--r--system/database/drivers/mysqli/mysqli_result.php19
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;