Merge branch 'current/for_cpan_index' into current/dq
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / ResultSource.pm
index 04f02cb..ca837ff 100644 (file)
@@ -1547,7 +1547,7 @@ sub _extract_fixed_values_for {
   return +{ map {
     is_Value($fixed->{$_})
       ? ($_ => $fixed->{$_}{value})
-      : ()
+      : (is_Literal($fixed->{$_}) ? ($_ => \($fixed->{$_})) : ())
   } keys %$fixed };
 }
 
@@ -1564,16 +1564,22 @@ sub _extract_fixed_conditions_for {
     ) {
       my ($l, $r) = @{$n->{args}};
       if (
-        is_Identifier($r) and @{$r->{elements}} == 2
-        and (!$alias or $r->{elements}[0] eq $alias)
+        is_Identifier($r) and (
+          !$alias
+          or (@{$r->{elements}} == 2
+              and $r->{elements}[0] eq $alias)
+        )
       ) {
         ($l, $r) = ($r, $l);
       }
       if (
-        is_Identifier($l) and @{$l->{elements}} == 2
-        and (!$alias or $l->{elements}[0] eq $alias)
+        is_Identifier($l) and (
+          !$alias
+          or (@{$l->{elements}} == 2
+              and $l->{elements}[0] eq $alias)
+        )
       ) {
-        $found{$l->{elements}[1]} = $r;
+        $found{$alias ? $l->{elements}[1] : join('.',@{$l->{elements}})} = $r;
       }
     }
   }
@@ -1596,12 +1602,6 @@ sub _extract_top_level_conditions {
   return @found;
 }
 
-sub compare_relationship_keys {
-  carp 'compare_relationship_keys is a private method, stop calling it';
-  my $self = shift;
-  $self->_compare_relationship_keys (@_);
-}
-
 # Returns true if both sets of keynames are the same, false otherwise.
 sub _compare_relationship_keys {
 #  my ($self, $keys1, $keys2) = @_;
@@ -1719,12 +1719,6 @@ sub _resolve_join {
   }
 }
 
-sub pk_depends_on {
-  carp 'pk_depends_on is a private method, stop calling it';
-  my $self = shift;
-  $self->_pk_depends_on (@_);
-}
-
 # Determines whether a relation is dependent on an object from this source
 # having already been inserted. Takes the name of the relationship and a
 # hashref of columns of the related object.
@@ -1770,13 +1764,9 @@ sub _pk_depends_on {
   return 1;
 }
 
-sub resolve_condition {
-  carp 'resolve_condition is a private method, stop calling it';
-  my $self = shift;
-  $self->_resolve_condition (@_);
-}
+our $UNRESOLVABLE_CONDITION = \Literal(SQL => '1 = 0');
 
-our $UNRESOLVABLE_CONDITION = \ '1 = 0';
+${$UNRESOLVABLE_CONDITION}->{'DBIx::Class::ResultSource.UNRESOLVABLE'} = 1;
 
 # Resolves the passed condition to a concrete query fragment and a flag
 # indicating whether this is a cross-table condition. Also an optional