BUGFIX: orderby clause not necessary for simple count queries, and will break MSSQL

This commit is contained in:
Geoff Munn 2009-08-11 21:09:31 +00:00
parent 5406ab5b60
commit 9e9cf9a4c2

View File

@ -57,9 +57,11 @@ class FileSubsites extends DataObjectDecorator {
break;
}
if(sizeof($query->select)>1 || $query->select[0]!='COUNT(*)'){
$query->orderby = 'SubsiteID' . ($query->orderby ? ', ' : '') . $query->orderby;
}
}
}
function augmentBeforeWrite() {
if(!$this->owner->ID && !$this->owner->SubsiteID) $this->owner->SubsiteID = Subsite::currentSubsiteID();