summaryrefslogtreecommitdiffstats
path: root/system/database
diff options
context:
space:
mode:
authorRick Ellis <rick.ellis@ellislab.com>2008-10-18 01:26:15 +0200
committerRick Ellis <rick.ellis@ellislab.com>2008-10-18 01:26:15 +0200
commit000f89d16ca48e5dd6a858911fd91484d7f1251f (patch)
tree229a1b274278c66ebd0a4b5da6525d480767f361 /system/database
parentead1f2d39f7b1ec9816db2807d4230bface79e13 (diff)
Diffstat (limited to 'system/database')
-rw-r--r--system/database/DB_active_rec.php21
1 files changed, 14 insertions, 7 deletions
diff --git a/system/database/DB_active_rec.php b/system/database/DB_active_rec.php
index f4c13cc42..47933ed78 100644
--- a/system/database/DB_active_rec.php
+++ b/system/database/DB_active_rec.php
@@ -412,7 +412,7 @@ class CI_DB_active_record extends CI_DB_driver {
foreach ($key as $k => $v)
{
- $prefix = (count($this->ar_where) == 0) ? '' : $type;
+ $prefix = (count($this->ar_where) == 0 AND count($this->ar_cache_where) == 0) ? '' : $type;
if (is_null($v) && ! $this->_has_operator($k))
{
@@ -1675,13 +1675,20 @@ class CI_DB_active_record extends CI_DB_driver {
return;
}
- $ar_items = array('select', 'from', 'join', 'where', 'like', 'groupby', 'having', 'orderby', 'set');
-
- foreach ($ar_items as $ar_item)
+ foreach (array('select', 'from', 'join', 'where', 'like', 'groupby', 'having', 'orderby', 'set') as $val)
{
- $ar_cache_item = 'ar_cache_'.$ar_item;
- $ar_item = 'ar_'.$ar_item;
- $this->$ar_item = array_unique(array_merge($this->$ar_item, $this->$ar_cache_item));
+ $ar_variable = 'ar_'.$val;
+ $ar_cache_var = 'ar_cache_'.$val;
+
+ if (count($this->$ar_cache_var) == 0)
+ {
+ continue;
+ }
+
+ // This doesn't seem to work right, per bug report #4995
+ // $this->$ar_variable = array_unique(array_merge($this->$ar_variable, $this->$ar_cache_var));
+
+ $this->$ar_variable = array_unique(array_merge($this->$ar_cache_var, $this->$ar_variable));
}
// If we are "protecting identifiers" we need to examine the "from"