[Bast-commits] r3485 - in branches/DBIx-Class-current: . lib/DBIx/Class t

matthewt at dev.catalyst.perl.org matthewt at dev.catalyst.perl.org
Sun Jun 10 17:10:38 GMT 2007


Author: matthewt
Date: 2007-06-10 17:10:37 +0100 (Sun, 10 Jun 2007)
New Revision: 3485

Modified:
   branches/DBIx-Class-current/Changes
   branches/DBIx-Class-current/lib/DBIx/Class/ResultSet.pm
   branches/DBIx-Class-current/t/67pager.t
Log:
fix page-within-page bug

Modified: branches/DBIx-Class-current/Changes
===================================================================
--- branches/DBIx-Class-current/Changes	2007-06-10 15:09:33 UTC (rev 3484)
+++ branches/DBIx-Class-current/Changes	2007-06-10 16:10:37 UTC (rev 3485)
@@ -1,5 +1,7 @@
 Revision history for DBIx::Class
 
+        - fixed page-within-page bug (reported by nilsonsfj)
+
 0.07999_05 2007-06-07 23:00:00
         - Made source_name rw in ResultSource
         - Fixed up SQL::Translator test/runtime dependencies

Modified: branches/DBIx-Class-current/lib/DBIx/Class/ResultSet.pm
===================================================================
--- branches/DBIx-Class-current/lib/DBIx/Class/ResultSet.pm	2007-06-10 15:09:33 UTC (rev 3484)
+++ branches/DBIx-Class-current/lib/DBIx/Class/ResultSet.pm	2007-06-10 16:10:37 UTC (rev 3485)
@@ -91,8 +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';

Modified: branches/DBIx-Class-current/t/67pager.t
===================================================================
--- branches/DBIx-Class-current/t/67pager.t	2007-06-10 15:09:33 UTC (rev 3484)
+++ branches/DBIx-Class-current/t/67pager.t	2007-06-10 16:10:37 UTC (rev 3485)
@@ -7,7 +7,7 @@
 
 my $schema = DBICTest->init_schema();
 
-plan tests => 12;
+plan tests => 13;
 
 # first page
 my $it = $schema->resultset("CD")->search(
@@ -68,3 +68,11 @@
 
 is( $it->next->title, "Generic Manufactured Singles", "software iterator->next ok" );
 
+# test paging with chained searches
+$it = $schema->resultset("CD")->search(
+    {},
+    { rows => 2,
+      page => 2 }
+)->search( undef, { order_by => 'title' } );
+
+is( $it->count, 2, "chained searches paging ok" );




More information about the Bast-commits mailing list