From a927ae4ee86fb6727ac340e7b96aee6f82b5542b Mon Sep 17 00:00:00 2001 From: Alex Fang Date: Thu, 22 Dec 2016 12:49:45 +0800 Subject: Fix bug: DB_query_builder do not add parenthesis for cached group_by --- system/database/DB_query_builder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system') diff --git a/system/database/DB_query_builder.php b/system/database/DB_query_builder.php index b88ec956a..6d165fc79 100644 --- a/system/database/DB_query_builder.php +++ b/system/database/DB_query_builder.php @@ -1402,7 +1402,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { $this->qb_orderby = NULL; } - $result = ($this->qb_distinct === TRUE OR ! empty($this->qb_groupby)) + $result = ($this->qb_distinct === TRUE OR ! empty($this->qb_groupby) OR in_array('groupby', $this->qb_cache_exists)) ? $this->query($this->_count_string.$this->protect_identifiers('numrows')."\nFROM (\n".$this->_compile_select()."\n) CI_count_all_results") : $this->query($this->_compile_select($this->_count_string.$this->protect_identifiers('numrows'))); -- cgit v1.2.3-24-g4f1b