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/ +

_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
Searchable Archive: http://www.mail-archive.com/[email protected]/

Reply via email to