[Dbix-class] offset being doubled when creating a resultset from an existing resultset.

brett gardner brett at clientcomm.com.au
Thu Oct 26 03:47:02 BST 2006


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.

Is this behaviour by design or a fault?




More information about the DBIx-Class mailing list