mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUGFIX: Fixed bug in SQLQuery::unlimitedRowCount() when used with grouped queries, that should fix a lot of pagination situations.
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.3@68940 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
f0e661a253
commit
5a5bdef2ba
@ -445,7 +445,16 @@ class SQLQuery extends Object {
|
||||
*
|
||||
* TODO Respect HAVING and GROUPBY, which can affect the result-count
|
||||
*/
|
||||
function unlimitedRowCount( $column = "*" ) {
|
||||
function unlimitedRowCount( $column = null) {
|
||||
// Choose a default column
|
||||
if($column == null) {
|
||||
if($this->groupby) {
|
||||
$column = 'DISTINCT ' . implode(", ", $this->groupby);
|
||||
} else {
|
||||
$column = '*';
|
||||
}
|
||||
}
|
||||
|
||||
$clone = clone $this;
|
||||
$clone->select = array("count($column)");
|
||||
$clone->limit = null;
|
||||
|
Loading…
Reference in New Issue
Block a user