summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2019-09-22 16:03:17 +0200
committerGitHub <noreply@github.com>2019-09-22 16:03:17 +0200
commit00df649efef7fe3420138c6f66c95ce1042ab3d2 (patch)
tree3a71432fd8cdce448b72852dfda06bf04d6bff78
parent4a72926167ca4c8edbee123cb53a56bd1e58a79e (diff)
parent304752dfa33e65e5fab722b5f4799f6c5bf16560 (diff)
Merge pull request #5834 from najdanovicivan/qb-count-having-fix
Fix count_all_result if QB query contains HAVING clause
-rw-r--r--system/database/DB_query_builder.php2
1 files changed, 1 insertions, 1 deletions
diff --git a/system/database/DB_query_builder.php b/system/database/DB_query_builder.php
index 12949c7dc..78e8018c7 100644
--- a/system/database/DB_query_builder.php
+++ b/system/database/DB_query_builder.php
@@ -1484,7 +1484,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')));