[Bast-commits] r8124 - DBIx-Class/0.08/branches/mssql_limit_regression/t

ribasushi at dev.catalyst.perl.org ribasushi at dev.catalyst.perl.org
Wed Dec 16 09:51:58 GMT 2009


Author: ribasushi
Date: 2009-12-16 09:51:58 +0000 (Wed, 16 Dec 2009)
New Revision: 8124

Modified:
   DBIx-Class/0.08/branches/mssql_limit_regression/t/746mssql.t
Log:
More moving around

Modified: DBIx-Class/0.08/branches/mssql_limit_regression/t/746mssql.t
===================================================================
--- DBIx-Class/0.08/branches/mssql_limit_regression/t/746mssql.t	2009-12-16 09:49:10 UTC (rev 8123)
+++ DBIx-Class/0.08/branches/mssql_limit_regression/t/746mssql.t	2009-12-16 09:51:58 UTC (rev 8124)
@@ -267,7 +267,54 @@
   is ($owners->count, 8, 'Correct amount of book owners');
   is ($owners->all, 8, 'Correct amount of book owner objects');
 }
+# make sure right-join-side single-prefetch ordering limit works
+{
+  my $rs = $schema->resultset ('BooksInLibrary')->search (
+    {
+      'owner.name' => { '!=', 'woggle' },
+    },
+    {
+      prefetch => 'owner',
+      order_by => 'owner.name',
+    }
+  );
+  # this is the order in which they should come from the above query
+  my @owner_names = qw/boggle fISMBoC fREW fRIOUX fROOH fRUE wiggle wiggle/;
 
+  is ($rs->all, 8, 'Correct amount of objects from right-sorted joined resultset');
+  is_deeply (
+    [map { $_->owner->name } ($rs->all) ],
+    \@owner_names,
+    'Rows were properly ordered'
+  );
+
+  my $limited_rs = $rs->search ({}, {rows => 7, offset => 2});
+  is ($limited_rs->count, 6, 'Correct count of limited right-sorted joined resultset');
+  is ($limited_rs->count_rs->next, 6, 'Correct count_rs of limited right-sorted joined resultset');
+
+  my $queries;
+  $schema->storage->debugcb(sub { $queries++; });
+  $schema->storage->debug(1);
+
+  is_deeply (
+    [map { $_->owner->name } ($limited_rs->all) ],
+    [@owner_names[2 .. 7]],
+    'Limited rows were properly ordered'
+  );
+  is ($queries, 1, 'Only one query with prefetch');
+
+  $schema->storage->debugcb(undef);
+  $schema->storage->debug(0);
+
+
+  is_deeply (
+    [map { $_->name } ($limited_rs->search_related ('owner')->all) ],
+    [@owner_names[2 .. 7]],
+    'Rows are still properly ordered after search_related'
+  );
+}
+
+
 #
 # try a prefetch on tables with identically named columns
 #
@@ -337,56 +384,24 @@
   is ($books->page(2)->count_rs->next, 1, 'Prefetched grouped search returns correct count_rs');
 }
 
-# make sure right-join-side single-prefetch ordering limit works
+
+
+# Just to aid bug-hunting, delete block before merging
 {
-  my $rs = $schema->resultset ('BooksInLibrary')->search (
+
+  my $limited_rs = $schema->resultset ('BooksInLibrary')->search (
     {
       'owner.name' => { '!=', 'woggle' },
     },
     {
       prefetch => 'owner',
       order_by => 'owner.name',
+      rows => 7,
+      offset => 2,
     }
   );
-  # this is the order in which they should come from the above query
-  my @owner_names = qw/boggle fISMBoC fREW fRIOUX fROOH fRUE wiggle wiggle/;
 
-  is ($rs->all, 8, 'Correct amount of objects from right-sorted joined resultset');
-  is_deeply (
-    [map { $_->owner->name } ($rs->all) ],
-    \@owner_names,
-    'Rows were properly ordered'
-  );
 
-  my $limited_rs = $rs->search ({}, {rows => 7, offset => 2});
-  is ($limited_rs->count, 6, 'Correct count of limited right-sorted joined resultset');
-  is ($limited_rs->count_rs->next, 6, 'Correct count_rs of limited right-sorted joined resultset');
-
-  my $queries;
-  $schema->storage->debugcb(sub { $queries++; });
-  $schema->storage->debug(1);
-
-  is_deeply (
-    [map { $_->owner->name } ($limited_rs->all) ],
-    [@owner_names[2 .. 7]],
-    'Limited rows were properly ordered'
-  );
-  is ($queries, 1, 'Only one query with prefetch');
-
-  $schema->storage->debugcb(undef);
-  $schema->storage->debug(0);
-
-
-  is_deeply (
-    [map { $_->name } ($limited_rs->search_related ('owner')->all) ],
-    [@owner_names[2 .. 7]],
-    'Rows are still properly ordered after search_related'
-  );
-
-
-# Just to aid bug-hunting, delete block before merging
-{
-
 =begin
 
 Alan's SQL:
@@ -442,8 +457,6 @@
   );
 }
 
-}
-
 done_testing;
 
 # clean up our mess




More information about the Bast-commits mailing list