Revision history for SQL::Abstract
+ - Fix false negative comparison of ORDER BY <function> ASC
+
revision 1.74 2013-06-04
----------------------------
- Fix insufficient parenthesis unroll during operator comparison
# deal with post-fix operators (asc/desc)
if ($tokens->[0] =~ $asc_desc_re) {
+ return @left if $state == PARSE_RHS;
@left = [ ('-' . uc (shift @$tokens)) => [ @left ] ];
}
],
},
{
+ equal => 1,
+ statements => [
+ q/ORDER BY colA, colB LIKE ? DESC, colC LIKE ?/,
+ q/ORDER BY colA ASC, colB LIKE ? DESC, colC LIKE ? ASC/,
+ ],
+ },
+ {
equal => 0,
opts => { order_by_asc_significant => 1 },
statements => [
]
], 'Lists parsed correctly');
-is_deeply($sqlat->parse('SELECT foo FROM bar ORDER BY x + ? DESC, oomph, y - ? DESC, unf, baz.g / ? ASC, buzz * 0 DESC, foo DESC, ickk ASC'), [
+is_deeply($sqlat->parse('SELECT foo FROM bar ORDER BY x + ? DESC, oomph, y - ? DESC, unf, baz.g / ? ASC, buzz * 0 DESC, foo LIKE ? DESC, ickk ASC'), [
[
"SELECT",
[
"-DESC",
[
[
- "-LITERAL",
+ "LIKE",
[
- "foo"
- ]
- ]
+ [
+ "-LITERAL",
+ [
+ "foo"
+ ]
+ ],
+ [
+ "-PLACEHOLDER",
+ [
+ "?"
+ ]
+ ],
+ ],
+ ],
]
],
[
],
],
[
- "max",
- [
- [
"-DESC",
[
[
"-MISC",
[
[
- "-MISC",
+ "-DESC",
[
[
- "-DESC",
+ "max",
[
[
"-PAREN",
]
]
]
- ]
- ],
- [
- "-LITERAL",
- [
- "x"
- ]
- ],
+ ],
+ ]
]
],
[
"-LITERAL",
[
- "z"
+ "x"
]
- ]
+ ],
+ [
+ "-LITERAL",
+ [
+ "z"
]
]
]