Revision history for SQL::Abstract
+ - Fix parsing of binary ops to correctly take up only a single LHS
+ element, instead of gobbling up the entire parse-to-date
+
revision 1.77 2014-01-17
----------------------------
- Reintroduce { -not => undef } column operator (regression from 1.75)
@right = $self->_recurse_parse($tokens, PARSE_IN_EXPR);
}
- @left = [$op => [ @left, @right ]];
+ push @left, [$op => [ (@left ? pop @left : ''), @right ]];
}
# unary op keywords
]
], 'real life statement 1 parsed correctly');
+is_deeply($sqlat->parse("CASE WHEN FOO() > BAR()"), [
+ [
+ "-MISC",
+ [
+ [
+ "-LITERAL",
+ [
+ "CASE"
+ ]
+ ],
+ [
+ "-LITERAL",
+ [
+ "WHEN"
+ ]
+ ]
+ ]
+ ],
+ [
+ ">",
+ [
+ [
+ "FOO",
+ [
+ [
+ "-PAREN",
+ []
+ ]
+ ]
+ ],
+ [
+ "BAR",
+ [
+ [
+ "-PAREN",
+ []
+ ]
+ ]
+ ]
+ ]
+ ]
+]);
+
+
is_deeply($sqlat->parse("SELECT x, y FROM foo WHERE x IN (?, ?, ?, ?)"), [
[
"SELECT",
"SELECT * FROM foo WHERE foo.a @@ to_tsquery('word')",
"SELECT * FROM foo ORDER BY name + ?, [me].[id]",
"SELECT foo AS bar FROM baz ORDER BY x + ? DESC, baz.g",
+ # deliberate batshit insanity
+ "SELECT foo FROM bar WHERE > 12",
);
# FIXME FIXME FIXME