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

Sam Kaufman sam.kaufman at takkle.com
Thu Jun 19 21:17:16 BST 2008


Ran into this inconsistency, we're using MySQL but I imagine it's probably the same for any db.

# say $parents is a resultset of 100 'parents'
# with each one having 20 'children'

my $rs = $parents->search({},
        {rows => 20}
);
# ^ Fine, gives you 20 parents

my $rs = $parents->search({},
        { rows => 20, prefetch => 'children' }
);
# ^ not fine, will give you one 'parent' because the 'rows' attribute gets
# piped in as 'LIMIT 20'




More information about the DBIx-Class mailing list