Subject: | use RAND instead of RANDOM for mysql. |
DBIx::Class::Helper::ResultSet::Random has 'RANDOM()' as the
%rand_order_by for 'DBIx::Class::Storage::DBI::mysql', but mysql really
uses 'RAND()'.
(http://dev.mysql.com/doc/refman/4.1/en/mathematical-functions.html#function_rand)
Attached a patch.
Subject: | mysql_random_fix.patch |
--- a/DBIx/Class/Helper/ResultSet/Random.pm 2009-12-30 13:02:29.000000000 -0600
+++ b/DBIx/Class/Helper/ResultSet/Random.pm 2010-01-21 10:23:15.000000000 -0600
@@ -11,7 +11,7 @@ use parent 'DBIx::Class::Helper::ResultS
# this is ghetto
my %rand_order_by = (
'DBIx::Class::Storage::DBI::SQLite' => 'RANDOM()',
- 'DBIx::Class::Storage::DBI::mysql' => 'RANDOM()',
+ 'DBIx::Class::Storage::DBI::mysql' => 'RAND()',
'DBIx::Class::Storage::DBI::ODBC::Microsoft_SQL_Server' => 'RAND()',
'DBIx::Class::Storage::DBI::MSSQL' => 'RAND()',
'DBIx::Class::Storage::DBI::Pg' => 'RAND()',