From: Matt S Trout Date: Tue, 26 Mar 2019 00:36:28 +0000 (+0000) Subject: move more expansion into andor X-Git-Tag: v1.90_01~326 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=5ce9d71b5e6d180b77a1e259140bbb156ca30d85;p=dbsrgits%2FSQL-Abstract.git move more expansion into andor --- diff --git a/lib/SQL/Abstract.pm b/lib/SQL/Abstract.pm index 3b7d65b..b2cca87 100644 --- a/lib/SQL/Abstract.pm +++ b/lib/SQL/Abstract.pm @@ -700,9 +700,9 @@ sub _expand_expr_hashpair_ident { : puke "operator '$op' applied on an empty array (field '$k')"; } return $self->_expand_op_andor($logic => [ - map +{ $k => { $vk => $_ } }, + map +{ $vk => $_ }, @values - ]); + ], $k); } if ( !defined($vv) @@ -834,8 +834,11 @@ sub _expand_bool { sub _expand_op_andor { my ($self, $logic, $v, $k) = @_; if (defined $k) { - $v = [ map +{ $k, { $_ => $v->{$_} } }, - sort keys %$v ]; + $v = [ map +{ $k, $_ }, + (ref($v) eq 'HASH') + ? (map +{ $_ => $v->{$_} }, sort keys %$v) + : @$v, + ]; } my ($logop) = $logic =~ /^-?(.*)$/; if (ref($v) eq 'HASH') {