Subject: | parens not parsing |
Hi there. It looks like SQL::Statement doesn't parse properly if the parenthesized OR statement contains a comparison to an empty string. The SQL below should parse, and does parse if you switch the order of the clauses around.
The problem looks like it's the regex in clean_sql() at line 1744, but that's all I can tell.
Details:
SQL-Statement-1.09
perl 5.8.0
Linux straylight.ensenda.com 2.4.18 #1 SMP Thu Mar 28 09:24:05 PST 2002 i686 unknown
Red Hat Linux release 7.2 (Enigma)
Error message:
SQL ERROR: Mismatched parentheses in WHERE clause!
Code to Reproduce:
$stmt = <<EOL;
select col1, col2, col3
from mytable
where
col1 = ?
AND (col2 = 'foo' OR col2 = '')
AND col3 = 'bar'
EOL
$stmt = SQL::Statement->new($stmt);
Thanks.