mirror of
https://github.com/silverstripe/silverstripe-subsites
synced 2024-10-22 11:05:55 +02:00
BUGFIX #5315 FileSubsites::augmentSQL() should not apply ordering when doing COUNT() selects, as this breaks some databases like SQL Server
This commit is contained in:
parent
8ee35be254
commit
c3b20fd3bd
@ -57,8 +57,10 @@ class FileSubsites extends DataObjectDecorator {
|
||||
break;
|
||||
}
|
||||
|
||||
// Ordering when deleting doesn't make sense
|
||||
if(!$query->delete) {
|
||||
$isCounting = strpos($query->select[0], 'COUNT') !== false;
|
||||
|
||||
// Ordering when deleting or counting doesn't apply
|
||||
if(!$query->delete && !$isCounting) {
|
||||
$query->orderby = "\"SubsiteID\"" . ($query->orderby ? ', ' : '') . $query->orderby;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user