diff options
author | Andrey Andreev <narf@devilix.net> | 2013-11-12 14:36:53 +0100 |
---|---|---|
committer | Andrey Andreev <narf@devilix.net> | 2013-11-12 14:36:53 +0100 |
commit | 81b21ed46b8cc5cdbe8431a7e30161b2cf80be7c (patch) | |
tree | fc3b8af618e7b96b498911e3e324158c8abcf7d5 /system/database/DB_query_builder.php | |
parent | c761a206def7714d18623d46b05adc2bbeedce21 (diff) | |
parent | 17a0528c23c4d6cf95b03299fbfe2ff789b82249 (diff) |
Merge pull request #2719 from GDmac/develop
Fix #2406 query builder cache
Diffstat (limited to 'system/database/DB_query_builder.php')
-rw-r--r-- | system/database/DB_query_builder.php | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/system/database/DB_query_builder.php b/system/database/DB_query_builder.php index a73460394..fb8514f5c 100644 --- a/system/database/DB_query_builder.php +++ b/system/database/DB_query_builder.php @@ -2557,18 +2557,19 @@ abstract class CI_DB_query_builder extends CI_DB_driver { return; } - foreach ($this->qb_cache_exists as $val) + foreach (array_unique($this->qb_cache_exists) as $val) // select, from, etc. { $qb_variable = 'qb_'.$val; $qb_cache_var = 'qb_cache_'.$val; - if (count($this->$qb_cache_var) > 0) + $qb_new = $this->$qb_cache_var; + + foreach ($this->$qb_variable as &$qb_var) { - foreach ($this->$qb_cache_var as &$cache_var) - { - in_array($cache_var, $this->$qb_variable, TRUE) OR $this->{$qb_variable}[] = $cache_var; - } + in_array($qb_var, $qb_new, TRUE) OR $qb_new[] = $qb_var; } + + $this->$qb_variable = $qb_new; } // If we are "protecting identifiers" we need to examine the "from" |