summaryrefslogtreecommitdiffstats
path: root/system/database/drivers/mysql/mysql_result.php
diff options
context:
space:
mode:
authorMichael Dennis <michaeljdennis@gmail.com>2011-08-29 19:06:59 +0200
committerMichael Dennis <michaeljdennis@gmail.com>2011-08-29 19:06:59 +0200
commit013f78dc6a878d7775aa2bbcef573934a6d88a72 (patch)
tree97ba05fd8e5efc066cb8f428744991fc628d207b /system/database/drivers/mysql/mysql_result.php
parentcb07a322bee5c5b0a551ab959c7475a1a702ad03 (diff)
parent70e61b5dc0b240c4a3341ca65ad9f2f5254df1b5 (diff)
Merge remote-tracking branch 'upstream/develop' into develop
Diffstat (limited to 'system/database/drivers/mysql/mysql_result.php')
-rw-r--r--system/database/drivers/mysql/mysql_result.php17
1 files changed, 11 insertions, 6 deletions
diff --git a/system/database/drivers/mysql/mysql_result.php b/system/database/drivers/mysql/mysql_result.php
index 507389603..6ceaf4b9b 100644
--- a/system/database/drivers/mysql/mysql_result.php
+++ b/system/database/drivers/mysql/mysql_result.php
@@ -84,14 +84,19 @@ class CI_DB_mysql_result extends CI_DB_result {
function field_data()
{
$retval = array();
- while ($field = mysql_fetch_field($this->result_id))
+ while ($field = mysql_fetch_object($this->result_id))
{
+ preg_match('/([a-zA-Z]+)(\((\d+)\))?/i', $field->Type, $matches);
+
+ $type = $matches[1];
+ $length = isset($matches[3]) ? (int) $matches[3] : NULL;
+
$F = new stdClass();
- $F->name = $field->name;
- $F->type = $field->type;
- $F->default = $field->def;
- $F->max_length = $field->max_length;
- $F->primary_key = $field->primary_key;
+ $F->name = $field->Field;
+ $F->type = $type;
+ $F->default = $field->Default;
+ $F->max_length = $length;
+ $F->primary_key = ( $field->Key == 'PRI' ? 1 : 0 );
$retval[] = $F;
}