Subject: | SET_FUNCTION_SPEC can't handle multiple, complex functions? |
So when my evil SQL statement looks like this:
SELECT ...
foo,
ROUND (
SUM((ROUND (sf.quantity * DECODE(sf.unit_cost, 0, si.unitcost, sf.unit_cost), 2) )) /
SUM (sf.quantity), 2
) avg_cost,
SUM ((
ROUND (sf.quantity * DECODE (sf.unit_cost, 0, si.unitcost, sf.unit_cost), 2)
)) extended_cost,
bar,
...
parse() explodes with errors like this:
Bad table or column name: ',2' has chars not alphanumeric or underscore! at graphviz.pl line
101.
at /Users/jhannah/src/SQL-Statement/lib/SQL/Parser.pm line 2950, <DATA> line 2242.
SQL::Parser::do_err('SQL::Parser=HASH(0x7ffcf6b84708)', 'Bad table or column name: \',2\'
has chars not alphanumeric o...') called at /Users/jhannah/src/SQL-
Statement/lib/SQL/Parser.pm line 2740
SQL::Parser::IDENTIFIER('SQL::Parser=HASH(0x7ffcf6b84708)', ',2') called at
/Users/jhannah/src/SQL-Statement/lib/SQL/Parser.pm line 2485
SQL::Parser::COLUMN_NAME('SQL::Parser=HASH(0x7ffcf6b84708)', ',2') called at
/Users/jhannah/src/SQL-Statement/lib/SQL/Parser.pm line 2408
SQL::Parser::ROW_VALUE('SQL::Parser=HASH(0x7ffcf6b84708)', ',2') called at
/Users/jhannah/src/SQL-Statement/lib/SQL/Parser.pm line 2245
SQL::Parser::ROW_VALUE('SQL::Parser=HASH(0x7ffcf6b84708)', 'SUM ((ROUND (sf.quantity *
DECODE (sf.unit_cost,0,si.unitcost...') called at /Users/jhannah/src/SQL-
Statement/lib/SQL/Parser.pm line 1438
SQL::Parser::SET_FUNCTION_SPEC('SQL::Parser=HASH(0x7ffcf6b84708)', 'ROUND (SUM
((ROUND (sf.quantity * DECODE (sf.unit_cost,0,si.u...') called at /Users/jhannah/src/SQL-
Statement/lib/SQL/Parser.pm line 1381
...
I'll try to create you a patch. Have you guys though about moving to github? :)
Thanks!
Jay Hannah