[Dbix-class] Prefetch with a has_many relationship and rows attribute

Christopher Davaz cdavaz at gmail.com
Fri Jun 20 01:36:07 BST 2008


Yes I also noticed this and wrote a test for it. I am not a DBIC
developer but I will take a shot at patching this in the near future
(unless one of the devs do it first).

On Fri, Jun 20, 2008 at 4:17 AM, Sam Kaufman <sam.kaufman at takkle.com> wrote:
> Ran into this inconsistency, we're using MySQL but I imagine it's probabl=
y the same for any db.
>
> # say $parents is a resultset of 100 'parents'
> # with each one having 20 'children'
>
> my $rs =3D $parents->search({},
>        {rows =3D> 20}
> );
> # ^ Fine, gives you 20 parents
>
> my $rs =3D $parents->search({},
>        { rows =3D> 20, prefetch =3D> 'children' }
> );
> # ^ not fine, will give you one 'parent' because the 'rows' attribute gets
> # piped in as 'LIMIT 20'
>
>
> _______________________________________________
> List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
> IRC: irc.perl.org#dbix-class
> SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
> Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.rawmod=
e.org
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 98rows_prefetch.t
Type: application/x-troff
Size: 981 bytes
Desc: not available
Url : http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20080620/ad=
983a12/98rows_prefetch.t


More information about the DBIx-Class mailing list