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(-) 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 From 8112b5341ec02d38e448e767ab95196df9a84a74 Mon Sep 17 00:00:00 2001 From: Alex Fang Date: Fri, 23 Dec 2016 10:38:11 +0800 Subject: 1. Updated last comit with comment for https://github.com/bcit-ci/CodeIgniter/pull/4955 --- system/database/DB_query_builder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/database/DB_query_builder.php b/system/database/DB_query_builder.php index 6d165fc79..48c857125 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) OR in_array('groupby', $this->qb_cache_exists)) + $result = ($this->qb_distinct === TRUE OR ! empty($this->qb_groupby) OR ! empty($this->qb_cache_groupby)) ? $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