diff options
author | GDmac <grdalenoort@gmail.com> | 2013-11-08 16:52:54 +0100 |
---|---|---|
committer | GDmac <grdalenoort@gmail.com> | 2013-11-08 16:52:54 +0100 |
commit | e1b8683d7983cca11219d618f093b842429bd41c (patch) | |
tree | 1d9717e925bc195f2c86d1e0869683c1774306e1 | |
parent | 0949b36c3ebb10732223ddc890e1a41c015aa086 (diff) |
Fix #2406 query builder cache
Signed-off-by: GDmac <grdalenoort@gmail.com>
-rw-r--r-- | system/database/DB_query_builder.php | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/system/database/DB_query_builder.php b/system/database/DB_query_builder.php index a73460394..0d0421306 100644 --- a/system/database/DB_query_builder.php +++ b/system/database/DB_query_builder.php @@ -2557,18 +2557,22 @@ abstract class CI_DB_query_builder extends CI_DB_driver { return; } - foreach ($this->qb_cache_exists as $val) + $parts = array_unique($this->qb_cache_exists); // select, from, etc. + + foreach ($parts as $val) { $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" |