Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the DBIx-Class-Helpers CPAN distribution.

Report information
The Basics
Id: 53885
Status: resolved
Priority: 0/
Queue: DBIx-Class-Helpers

People
Owner: Nobody in particular
Requestors: mzrinsky [...] redanvil.net
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 2.00102
Fixed in: (no value)



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()',
Subject: Re: [rt.cpan.org #53885] use RAND instead of RANDOM for mysql.
Date: Thu, 21 Jan 2010 22:48:46 -0600
To: bug-DBIx-Class-Helpers [...] rt.cpan.org
From: fREW Schmidt <frioux [...] gmail.com>
On Thu, Jan 21, 2010 at 10:34 AM, via RT <bug-DBIx-Class-Helpers@rt.cpan.org> wrote: Show quoted text
> Thu Jan 21 11:34:28 2010: Request 53885 was acted upon. > Transaction: Ticket created by pldoh >       Queue: DBIx-Class-Helpers >     Subject: use RAND instead of RANDOM for mysql. >   Broken in: 2.00102 >    Severity: Normal >       Owner: Nobody >  Requestors: mzrinsky@redanvil.net >      Status: new >  Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=53885 > > > > 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. >
Thanks for the tip! I've added this to version control and it will be released immediately after the next release of DBIC (I'm blocking on some features) hopefully in about a week. -- fREW Schmidt http://blog.afoolishmanifesto.com