From: Matt S Trout Date: Fri, 15 Nov 2013 15:33:49 +0000 (+0000) Subject: make extract_fixed_values work without an alias, make _extract_fixed_condition_column... X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=bcf127a59c3cdddc0a609b73fa64fb66cce61976;p=dbsrgits%2FDBIx-Class.git make extract_fixed_values work without an alias, make _extract_fixed_condition_columns use it --- diff --git a/lib/DBIx/Class/ResultSource.pm b/lib/DBIx/Class/ResultSource.pm index c9c86dc..565410e 100644 --- a/lib/DBIx/Class/ResultSource.pm +++ b/lib/DBIx/Class/ResultSource.pm @@ -1555,13 +1555,13 @@ sub _extract_fixed_conditions_for { my ($l, $r) = @{$n->{args}}; if ( is_Identifier($r) and @{$r->{elements}} == 2 - and $r->{elements}[0] eq $alias + and (!$alias or $r->{elements}[0] eq $alias) ) { ($l, $r) = ($r, $l); } if ( is_Identifier($l) and @{$l->{elements}} == 2 - and $l->{elements}[0] eq $alias + and (!$alias or $l->{elements}[0] eq $alias) ) { $found{$l->{elements}[1]} = $r; } elsif (($n->{operator}{Perl}||'') eq 'and') { diff --git a/lib/DBIx/Class/Storage/DBIHacks.pm b/lib/DBIx/Class/Storage/DBIHacks.pm index 6f3a57a..3033173 100644 --- a/lib/DBIx/Class/Storage/DBIHacks.pm +++ b/lib/DBIx/Class/Storage/DBIHacks.pm @@ -981,6 +981,12 @@ sub _main_source_order_by_portion_is_stable { sub _extract_fixed_condition_columns { my ($self, $where) = @_; + if (ref($where) eq 'REF' and ref($$where) eq 'HASH') { + # Yes. I know. + my $fixed = DBIx::Class::ResultSource->_extract_fixed_values_for($$where); + return [ keys %$fixed ]; + } + return unless ref $where eq 'HASH'; my @cols;