Skip Menu |
 

This queue is for tickets about the DBIx-Class CPAN distribution.

Report information
The Basics
Id: 27486
Status: resolved
Priority: 0/
Queue: DBIx-Class

People
Owner: Nobody in particular
Requestors: john.seaver [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: DBIx::Class Bug: Offset Always Incremented
Date: Thu, 7 Jun 2007 11:57:04 -0700
To: bug-DBIx-Class [...] rt.cpan.org
From: "John Seaver" <john.seaver [...] gmail.com>
Download (untitled) / with headers
text/plain 773b
Whenever a ResultSet is "cloned" the offset is incremented instead of simply re-calculated. Here is how to re-create the problem: for (1 .. 10) { $rs = $rs->search({}, { page => 2, rows => 25 }); print $rs->{'attrs'}->{'offset'}, "\n"; } Or using a more direct method... for (1 .. 10) { $rs = $rs->page(2); print $rs->{'attrs'}->{'offset'}, "\n"; } Here is a patch to fix the problem: --- ResultSet.pm.orig Thu Jun 7 11:46:21 2007 +++ ResultSet.pm Thu Jun 7 11:46:37 2007 @@ -91,7 +91,7 @@ if ($attrs->{page}) { $attrs->{rows} ||= 10; $attrs->{offset} ||= 0; - $attrs->{offset} += ($attrs->{rows} * ($attrs->{page} - 1)); + $attrs->{offset} = ($attrs->{rows} * ($attrs->{page} - 1)); } $attrs->{alias} ||= 'me';
fixed in 08000+ so far as I'm aware, please re-open if not


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.