summaryrefslogtreecommitdiffstats
path: root/system/database/DB_query_builder.php
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2017-06-15 13:22:49 +0200
committerAndrey Andreev <narf@devilix.net>2017-06-15 13:23:28 +0200
commit2c1b3d9694e570c45ac82fcefbb51c965c6ea8a8 (patch)
tree273d1c2f5156a22e7502b6c10cd42f23a707dde7 /system/database/DB_query_builder.php
parentfffdd9c20b2faa49070e67ec59f03c262085d7fc (diff)
Merge pull request #5155 from tianhe1986/develop_count_ignore_limit
Fix CI_DB_query_builder::count_all_results() returning wrong count with LIMIT/OFFSET
Diffstat (limited to 'system/database/DB_query_builder.php')
-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 0abf2a260..9216651aa 100644
--- a/system/database/DB_query_builder.php
+++ b/system/database/DB_query_builder.php
@@ -1409,7 +1409,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 ! empty($this->qb_cache_groupby))
+ $result = ($this->qb_distinct === TRUE OR ! empty($this->qb_groupby) OR ! empty($this->qb_cache_groupby) 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')));