X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FSQL%2FAbstract.pm;h=0eff6a59ecc6f9a778e8b8584375b89f65a50e47;hb=2e6704698a31dc5281609064714f98d080f83971;hp=aa1e95eb557423f805900fe1420c877bc6eb2bbb;hpb=325d3fb458ed892ceb73e3c4dcc03281f8d5ae25;p=scpubgit%2FQ-Branch.git diff --git a/lib/SQL/Abstract.pm b/lib/SQL/Abstract.pm index aa1e95e..0eff6a5 100644 --- a/lib/SQL/Abstract.pm +++ b/lib/SQL/Abstract.pm @@ -622,6 +622,12 @@ sub _expand_expr_hashpair { sub _expand_expr_hashpair_ident { my ($self, $k, $v) = @_; + # hash with multiple or no elements is andor + + if (ref($v) eq 'HASH' and keys %$v != 1) { + return $self->_expand_op_andor(-and => $v, $k); + } + # undef needs to be re-sent with cmp to achieve IS/IS NOT NULL if ( @@ -651,10 +657,6 @@ sub _expand_expr_hashpair_ident { ); } if (ref($v) eq 'HASH') { - if (keys %$v > 1) { - return $self->_expand_op_andor(-and => $v, $k); - } - return undef unless keys %$v; my ($vk, $vv) = %$v; my $op = join ' ', split '_', (map lc, $vk =~ /^-?(.*)$/)[0]; $self->_assert_pass_injection_guard($op); @@ -858,6 +860,7 @@ sub _expand_op_andor { } my ($logop) = $logic =~ /^-?(.*)$/; if (ref($v) eq 'HASH') { + return undef unless keys %$v; return +{ -op => [ $logop, map $self->_expand_expr({ $_ => $v->{$_} }),