Skip to content

Commit

Permalink
Merge pull request #5282 from pgee70/patch-1
Browse files Browse the repository at this point in the history
Fix ORDER BY clauses being reset by count_all_results()
  • Loading branch information
narfbg committed Oct 3, 2017
2 parents c495515 + cf3924e commit 308eb0f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion system/database/DB_query_builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -1405,7 +1405,7 @@ public function count_all_results($table = '', $reset = TRUE)
// for selecting COUNT(*) ...
$qb_orderby = $this->qb_orderby;
$qb_cache_orderby = $this->qb_cache_orderby;
$this->qb_orderby = $this->qb_cache_orderby = NULL;
$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)
? $this->query($this->_count_string.$this->protect_identifiers('numrows')."\nFROM (\n".$this->_compile_select()."\n) CI_count_all_results")
Expand Down

0 comments on commit 308eb0f

Please sign in to comment.