[Bast-commits] r8103 - DBIx-Class/0.08/branches/mssql_limit_regression/lib/DBIx/Class/Storage

ribasushi at dev.catalyst.perl.org ribasushi at dev.catalyst.perl.org
Sat Dec 12 23:21:05 GMT 2009


Author: ribasushi
Date: 2009-12-12 23:21:05 +0000 (Sat, 12 Dec 2009)
New Revision: 8103

Modified:
   DBIx-Class/0.08/branches/mssql_limit_regression/lib/DBIx/Class/Storage/DBI.pm
Log:
Isolate prefetch heads using RNO with a subquery

Modified: DBIx-Class/0.08/branches/mssql_limit_regression/lib/DBIx/Class/Storage/DBI.pm
===================================================================
--- DBIx-Class/0.08/branches/mssql_limit_regression/lib/DBIx/Class/Storage/DBI.pm	2009-12-12 23:19:57 UTC (rev 8102)
+++ DBIx-Class/0.08/branches/mssql_limit_regression/lib/DBIx/Class/Storage/DBI.pm	2009-12-12 23:21:05 UTC (rev 8103)
@@ -1774,11 +1774,24 @@
 
   my @limit;
 
-  # see if we need to tear the prefetch apart (either limited has_many or grouped prefetch)
-  # otherwise delegate the limiting to the storage, unless software limit was requested
+  # see if we need to tear the prefetch apart otherwise delegate the limiting to the
+  # storage, unless software limit was requested
   if (
+    #limited has_many
     ( $attrs->{rows} && keys %{$attrs->{collapse}} )
        ||
+    # limited prefetch with RNO subqueries
+    (
+      $attrs->{rows}
+        &&
+      $sql_maker->limit_dialect eq 'RowNumberOver'
+        &&
+      $attrs->{_prefetch_select}
+        &&
+      @{$attrs->{_prefetch_select}}
+    )
+      ||
+    # grouped prefetch
     ( $attrs->{group_by}
         &&
       @{$attrs->{group_by}}
@@ -1788,7 +1801,6 @@
       @{$attrs->{_prefetch_select}}
     )
   ) {
-
     ($ident, $select, $where, $attrs)
       = $self->_adjust_select_args_for_complex_prefetch ($ident, $select, $where, $attrs);
   }




More information about the Bast-commits mailing list