summaryrefslogtreecommitdiffstats
path: root/system/database/DB_driver.php
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-02-10 13:40:14 +0100
committerAndrey Andreev <narf@bofh.bg>2012-02-10 13:40:14 +0100
commita563fac0fb822169eb4ee8a5f98324bdab15321b (patch)
tree485445b9af5d8ec16de8bb0cea0e7260f3d8db7c /system/database/DB_driver.php
parent569091cf6ad7101059e6a4ffbd93f227aad9937f (diff)
parent16af6afe991381360439135ddb0735dab1280fed (diff)
Merge upstream branch
Diffstat (limited to 'system/database/DB_driver.php')
-rw-r--r--system/database/DB_driver.php27
1 files changed, 13 insertions, 14 deletions
diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php
index daca08f0f..44e7ad8c7 100644
--- a/system/database/DB_driver.php
+++ b/system/database/DB_driver.php
@@ -81,8 +81,7 @@ class CI_DB_driver {
var $stmt_id;
var $curs_id;
var $limit_used;
-
-
+
/**
* Constructor. Accepts one parameter containing the database
@@ -812,20 +811,23 @@ class CI_DB_driver {
if ($query->num_rows() > 0)
{
- foreach ($query->result_array() as $row)
+ $table = FALSE;
+ $rows = $query->result_array();
+ $key = (($row = current($rows)) && in_array('table_name', array_map('strtolower', array_keys($row))));
+
+ if ($key)
{
- if (isset($row['TABLE_NAME']))
- {
- $retval[] = $row['TABLE_NAME'];
- }
- else
- {
- $retval[] = array_shift($row);
- }
+ $table = array_key_exists('TABLE_NAME', $row) ? 'TABLE_NAME' : 'table_name';
+ }
+
+ foreach ($rows as $row)
+ {
+ $retval[] = ( ! $table) ? current($row) : $row[$table];
}
}
$this->data_cache['table_names'] = $retval;
+
return $this->data_cache['table_names'];
}
@@ -1434,10 +1436,7 @@ class CI_DB_driver {
return $item.$alias;
}
-
-
}
-
/* End of file DB_driver.php */
/* Location: ./system/database/DB_driver.php */