Revision history for SQL::Abstract
- Add support for NULLS FIRST/LAST in ORDER BY
+ - Fix insufficient parenthesis unroll during operator comparison
revision 1.73 2012-07-10
----------------------------
$changes++;
}
+ # a construct of ... ( somefunc ( ... ) ) ... can safely lose the outer parens
+ # except for the case of ( NOT ( ... ) ) which has already been handled earlier
+ elsif (
+ @{$child->[1]} == 1
+ and
+ @{$child->[1][0][1]} == 1
+ and
+ $child->[1][0][0] ne 'NOT'
+ and
+ ref $child->[1][0][1][0] eq 'ARRAY'
+ and
+ $child->[1][0][1][0][0] eq '-PAREN'
+ ) {
+ push @children, @{$child->[1]};
+ $changes++;
+ }
+
# otherwise no more mucking for this pass
else {
'WHERE ( foo GLOB ? )',
'WHERE foo GLOB ?',
],
- }
+ },
+ {
+ equal => 1,
+ statements => [
+ 'SELECT FIRST ? SKIP ? [me].[id], [me].[owner]
+ FROM [books] [me]
+ WHERE ( ( (EXISTS (
+ SELECT FIRST ? SKIP ? [owner].[id]
+ FROM [owners] [owner]
+ WHERE ( [books].[owner] = [owner].[id] )
+ )) AND [source] = ? ) )',
+ 'SELECT FIRST ? SKIP ? [me].[id], [me].[owner]
+ FROM [books] [me]
+ WHERE ( ( EXISTS (
+ SELECT FIRST ? SKIP ? [owner].[id]
+ FROM [owners] [owner]
+ WHERE ( [books].[owner] = [owner].[id] )
+ ) AND [source] = ? ) )',
+ ],
+ },
);
my @bind_tests = (