[Dbix-class] DBIx::Class::Helper::ResultSet::Random and Oracle

Peter Rabbitson rabbit+dbic at rabbit.us
Wed Dec 19 07:31:37 GMT 2012


On Wed, Dec 19, 2012 at 01:15:46AM +0100, "José Diaz Seng" wrote:
> Hi Arthur Axel,
> 
>  motivated by your email (see below) I refactored my module, version 0.004 is based on
>  DBIC (Schema Loader).
> 
>  I was doing some tests before the upload to CPAN and noticed that the rand() method of 
>  DBIx::Class::Helper::ResultSet::Random (current version 2.016003) led to an error (RAND() being
>  used in the resulting SQL instead of dbms_random.value) since it did not pick up the correct value
>  from the hash %rand_order_by, the reason being that
> 
>  ref $self->result_source->storage

This is an implementation bug (and yes, he does say it is "ghetto" in a 
comment). The code needs to do an ->isa check against all available 
keys, starting with longest class first (i.e. try DBI::ODBC::X before 
DBI::X). Could you help the author by submitting a patch to that effect?

Cheers




More information about the DBIx-Class mailing list