Comment weird looking code
[dbsrgits/DBIx-Class-Historic.git] / lib / DBIx / Class / SQLAHacks.pm
index 71b89ff..d6abcba 100644 (file)
@@ -140,7 +140,7 @@ sub _subqueried_limit_attrs {
       next if $in_sel_index->{$chunk};
 
       $extra_order_sel{$chunk} ||= $self->_quote (
-        '__ORDER_BY_' . scalar keys %extra_order_sel
+        'ORDER__BY__' . scalar keys %extra_order_sel
       );
     }
   }
@@ -381,7 +381,7 @@ sub _Top {
     $sql,
     $quoted_rs_alias,
     $order_by_requested,
-  ) if ($order_by_requested || ($mid_sel ne $out_sel));
+  ) if ( ($offset && $order_by_requested) || ($mid_sel ne $out_sel) );
 
   return $sql;
 }