From: Peter Rabbitson Date: Sun, 8 Mar 2009 22:31:51 +0000 (+0000) Subject: Deal properly with () in is_same_sql_bind X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d15c14ccfb2fad9248aeb856592d7ad0ef65d74f;p=scpubgit%2FQ-Branch.git Deal properly with () in is_same_sql_bind --- diff --git a/lib/SQL/Abstract/Test.pm b/lib/SQL/Abstract/Test.pm index 9bc7a95..ed68506 100644 --- a/lib/SQL/Abstract/Test.pm +++ b/lib/SQL/Abstract/Test.pm @@ -161,11 +161,15 @@ sub _eq_sql { my ($left, $right) = @_; # ignore top-level parentheses - while ($left->[0] eq 'PAREN') {$left = $left->[1] } - while ($right->[0] eq 'PAREN') {$right = $right->[1]} + while ($left->[0] and $left->[0] eq 'PAREN') {$left = $left->[1] } + while ($right->[0] and $right->[0] eq 'PAREN') {$right = $right->[1]} + # if both are undef i.e. () + if (not grep { defined $_ } ($left->[0], $right->[0]) ) { + return 1; + } # if operators are different - if ($left->[0] ne $right->[0]) { + elsif ($left->[0] ne $right->[0]) { $sql_differ = sprintf "OP [$left->[0]] != [$right->[0]] in\nleft: %s\nright: %s\n", unparse($left), unparse($right);