From: Peter Rabbitson Date: Tue, 24 Mar 2009 07:13:34 +0000 (+0000) Subject: Sanify patch by arcanez - we do not gobble any -X op, just -and/-or X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=04d940de7ec9dc86f43fc2935296f51c33c9ddad;p=scpubgit%2FQ-Branch.git Sanify patch by arcanez - we do not gobble any -X op, just -and/-or --- diff --git a/lib/SQL/Abstract.pm b/lib/SQL/Abstract.pm index ea890ce..01a7574 100644 --- a/lib/SQL/Abstract.pm +++ b/lib/SQL/Abstract.pm @@ -499,11 +499,17 @@ sub _where_hashpair_ARRAYREF { $self->_debug("ARRAY($k) means distribute over elements"); # put apart first element if it is an operator (-and, -or) - my $op = $v[0] =~ /^-/ ? shift @v : undef; - $self->_debug("OP($op) reinjected into the distributed array") if $op; - + my $op = ($v[0] =~ /^ - (?: AND|OR ) $/ix + ? shift @v + : '' + ); my @distributed = map { {$k => $_} } @v; - unshift @distributed, $op if $op; + + if ($op) { + $self->_debug("OP($op) reinjected into the distributed array"); + unshift @distributed, $op; + } + my $logic = $op ? substr($op, 1) : ''; return $self->_recurse_where(\@distributed, $logic);