From 43f48dca37bd84b41ebbc076b9b3967970413e98 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sun, 22 Sep 2019 17:03:17 +0300 Subject: Merge pull request #5834 from najdanovicivan/qb-count-having-fix Fix count_all_result if QB query contains HAVING clause --- 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 f35b9fd0a..b1b76e46b 100644 --- a/system/database/DB_query_builder.php +++ b/system/database/DB_query_builder.php @@ -1412,7 +1412,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { $qb_cache_orderby = $this->qb_cache_orderby; $this->qb_orderby = $this->qb_cache_orderby = array(); - $result = ($this->qb_distinct === TRUE OR ! empty($this->qb_groupby) OR ! empty($this->qb_cache_groupby) OR $this->qb_limit OR $this->qb_offset) + $result = ($this->qb_distinct === TRUE OR ! empty($this->qb_groupby) OR ! empty($this->qb_cache_groupby) OR ! empty($this->qb_having) OR $this->qb_limit OR $this->qb_offset) ? $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