[Bast-commits] r8032 - DBIx-Class/0.08/branches/mssql_rno_pagination/lib/DBIx/Class/Storage/DBI

ribasushi at dev.catalyst.perl.org ribasushi at dev.catalyst.perl.org
Fri Dec 4 10:47:22 GMT 2009


Author: ribasushi
Date: 2009-12-04 10:47:22 +0000 (Fri, 04 Dec 2009)
New Revision: 8032

Modified:
   DBIx-Class/0.08/branches/mssql_rno_pagination/lib/DBIx/Class/Storage/DBI/MSSQL.pm
Log:
Smarter implementation of the select top 100pct subselect handling

Modified: DBIx-Class/0.08/branches/mssql_rno_pagination/lib/DBIx/Class/Storage/DBI/MSSQL.pm
===================================================================
--- DBIx-Class/0.08/branches/mssql_rno_pagination/lib/DBIx/Class/Storage/DBI/MSSQL.pm	2009-12-04 10:44:47 UTC (rev 8031)
+++ DBIx-Class/0.08/branches/mssql_rno_pagination/lib/DBIx/Class/Storage/DBI/MSSQL.pm	2009-12-04 10:47:22 UTC (rev 8032)
@@ -185,11 +185,21 @@
 sub _select_args_to_query {
   my $self = shift;
 
+  # _select_args does some shady action at a distance
+  # see DBI.pm for more info
   my $sql_maker = $self->sql_maker;
-  my ($op, $bind, $ident, $bind_attrs, $select, $cond, $order) = $self->_select_args(@_);
+  my ($op, $bind, $ident, $bind_attrs, $select, $cond, $order, $rows, $offset);
+  {
+    local $sql_maker->{_dbic_rs_attrs};
+    ($op, $bind, $ident, $bind_attrs, $select, $cond, $order, $rows, $offset) = $self->_select_args(@_);
+  }
 
-  if (not scalar $sql_maker->_order_by_chunks ($order->{order_by}) ) {
-    # no ordering, just short circuit
+  if (
+    ($rows || $offset)
+      ||
+    not scalar $sql_maker->_order_by_chunks ($order->{order_by})
+  ) {
+    # either limited RS or no ordering, just short circuit
     return $self->next::method (@_);
   }
 




More information about the Bast-commits mailing list