From a20818b529d973f6b0ef0ed606f6eeb4a2b7f460 Mon Sep 17 00:00:00 2001 From: Geoff Munn Date: Thu, 17 Sep 2009 00:05:23 +0000 Subject: [PATCH] ENHANCEMENT: Database specific version of RANDOM() created git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@86506 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- core/model/MySQLDatabase.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/core/model/MySQLDatabase.php b/core/model/MySQLDatabase.php index 7f0a2a646..2efc2cf5f 100644 --- a/core/model/MySQLDatabase.php +++ b/core/model/MySQLDatabase.php @@ -806,7 +806,7 @@ class MySQLDatabase extends Database { foreach($records as $record) $objects[] = new $record['ClassName']($record); - + if(isset($objects)) $doSet = new DataObjectSet($objects); else $doSet = new DataObjectSet(); @@ -823,6 +823,13 @@ class MySQLDatabase extends Database { return 'NOW()'; } + /* + * Returns the database-specific version of the random() function + */ + function random(){ + return 'RAND()'; + } + /* * This will return text which has been escaped in a database-friendly manner * Using PHP's addslashes method won't work in MSSQL