BUGFIX: Don't use _SortColumn syntax when randomly sorting.

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@76370 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2009-05-07 06:00:02 +00:00
parent f296534380
commit 32ed6da54c

View File

@ -201,7 +201,7 @@ class SQLQuery extends Object {
// If sort contains a function call, let's move the sort clause into a separate selected field.
// Some versions of MySQL choke if you have a group function referenced directly in the ORDER BY
if($combinedOrderby && strpos($combinedOrderby,'(') !== false) {
if($combinedOrderby && strpos($combinedOrderby,'(') !== false && strtoupper(trim($combinedOrderby)) != 'RAND()') {
// Sort can be "Col1 DESC|ASC, Col2 DESC|ASC", we need to handle that
$sortParts = explode(",", $combinedOrderby);