[Dbix-class] Re: Prefetch and join on different tables

Charlie Garrison garrison at zeta.org.au
Tue Jan 22 01:38:06 GMT 2013


Good afternoon,

On 21/01/13 at 5:39 PM -0300, Paula <mpmagarinos at gmail.com> wrote:

>2013/1/21 Dagfinn Ilmari Mannsåker <ilmari at ilmari.org>
>
>> ->search($where, { %{$attr}, prefetch => 'mc', join => 'mt' });
>
>
>I have just tried that, and again I get:
>[error] DBIx::Class::Row::get_column(): No such column 'h1'
>
>It seems the order is important, the last argument (prefetch or join) is
>the only one that is executed...

Correct, since standard perl behaviour says there is only one key in a hash.

Assuming $attr->{join} is currently a string (if already arrayref then just push onto it):

  $attr->{join} = [$attr->{join}, 'mt'];
  $attr->{prefetch} = [$attr->{prefetch}, 'mc'];
  search($where, $attr});


Charlie

-- 
   Ꮚ Charlie Garrison ♊ <garrison at zeta.org.au>
   
O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
〠  http://www.ietf.org/rfc/rfc1855.txt




More information about the DBIx-Class mailing list