[Dbix-class] offset being doubled when creating a resultset from
an existing resultset.
Matt S Trout
dbix-class at trout.me.uk
Sat Oct 28 16:02:25 GMT 2006
brett gardner wrote:
> Okay if you have the following resultset
>
> $rs = $schema->resultset('Foo')->search(
> undef,
> {
> page=>1,
> rows=>5
> }
> );
>
> Which would generate the following SQL when $rs->next is called
>
> SELECT ... FROM ... WHERE ... LIMIT 5 OFFSET 5;
>
> and then create a resultset from this again
>
> $new_rs = $rs->search({foo=>'bar'});
>
> This creates the following SQL when $new_rs->next is called.
>
> SELECT ... FROM ... WHERE ... LIMIT 5 OFFSET 10;
>
> Setting the 'page' in the $new_rs attributes does not fix this. Only by
> setting the
> 'offset' attribute to 0 is this fixed.
Try doing it by calling ->page($page), but that's probably a bug nonetheless.
If somebody can work up a test patch I'd be delighted to fix it.
--
Matt S Trout Offering custom development, consultancy and support
Technical Director contracts for Catalyst, DBIx::Class and BAST. Contact
Shadowcat Systems Ltd. mst (at) shadowcatsystems.co.uk for more information
+ Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/ +
More information about the Dbix-class
mailing list