Pass the main rsrc in attrs, instead of trying to fish it out later
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Storage / DBIHacks.pm
index 7a3587d..1bb9224 100644 (file)
@@ -887,13 +887,13 @@ sub _order_by_is_stable {
   my @cols = (
     ( map { $_->[0] } $self->_extract_order_criteria($order_by) ),
     ( $where ? @{ $self->_extract_fixed_condition_columns($where) || [] } : () ),
-  ) or return undef;
+  ) or return 0;
 
   my $colinfo = $self->_resolve_column_info($ident, \@cols);
 
   return keys %$colinfo
     ? $self->_columns_comprise_identifying_set( $colinfo,  \@cols )
-    : undef
+    : 0
   ;
 }
 
@@ -909,14 +909,14 @@ sub _columns_comprise_identifying_set {
     return 1 if $src->_identifying_column_set($_);
   }
 
-  return undef;
+  return 0;
 }
 
-# this is almost identical to the above, except it accepts only
+# this is almost similar to _order_by_is_stable, except it takes
 # a single rsrc, and will succeed only if the first portion of the order
 # by is stable.
 # returns that portion as a colinfo hashref on success
-sub _main_source_order_by_portion_is_stable {
+sub _extract_colinfo_of_stable_main_source_order_by_portion {
   my ($self, $main_rsrc, $order_by, $where) = @_;
 
   die "Huh... I expect a blessed result_source..."
@@ -1207,9 +1207,17 @@ sub _extract_fixed_condition_columns {
       if (
         ! length ref $v
           or
-        (ref $v eq 'HASH' and keys %$v == 1 and defined $v->{'='} and (
-          is_literal_value($v->{'='}) or is_plain_value( $v->{'='})
-        ))
+        is_plain_value ($v)
+          or
+        (
+          ref $v eq 'HASH'
+            and
+          keys %$v == 1
+            and
+          ref $v->{'='}
+            and
+          is_literal_value($v->{'='})
+        )
       ) {
         $res->{$c} = 1;
       }