'GROUP \s+ BY',
'HAVING',
'ORDER \s+ BY',
+ 'I?LIKE',
);
my $unrollable_ops_re = join ' | ', @unrollable_ops;
$unrollable_ops_re = qr/$unrollable_ops_re/xi;
}
# only *ONE* LITERAL or placeholder element
+ # as an AND/OR/NOT argument
elsif (
@{$child->[1]} == 1 && (
$child->[1][0][0] eq 'LITERAL'
or
$child->[1][0][0] eq 'PLACEHOLDER'
+ ) && (
+ $ast->[0] eq 'AND' or $ast->[0] eq 'OR' or $ast->[0] eq 'NOT'
)
) {
push @children, $child->[1][0];
func => 'update',
new => {bindtype => 'columns'},
args => ['test', {a => 1, b => \["to_date(?, 'MM/DD/YY')", [{dummy => 1} => '02/02/02']], c => { -lower => 'foo' }}, {a => {'between', [1,2]}}],
- stmt => "UPDATE test SET a = ?, b = to_date(?, 'MM/DD/YY'), c = LOWER( ? ) WHERE ( a BETWEEN ? AND ? )",
- stmt_q => "UPDATE `test` SET `a` = ?, `b` = to_date(?, 'MM/DD/YY'), `c` = LOWER ( ? ) WHERE ( `a` BETWEEN ? AND ? )",
+ stmt => "UPDATE test SET a = ?, b = to_date(?, 'MM/DD/YY'), c = LOWER ? WHERE ( a BETWEEN ? AND ? )",
+ stmt_q => "UPDATE `test` SET `a` = ?, `b` = to_date(?, 'MM/DD/YY'), `c` = LOWER ? WHERE ( `a` BETWEEN ? AND ? )",
bind => [[a => '1'], [{dummy => 1} => '02/02/02'], [c => 'foo'], [a => '1'], [a => '2']],
},
{
'SELECT foo FROM bar ()',
]
},
- # single ? of unknown funcs can unroll
- # (think ...LIKE ?...)
{
- equal => 1,
+ equal => 0,
statements => [
- 'SELECT foo FROM bar WHERE bar > foo ?',
- 'SELECT foo FROM bar WHERE bar > foo (?)',
- 'SELECT foo FROM bar WHERE bar > foo( ? )',
+ 'SELECT COUNT * FROM foo',
+ 'SELECT COUNT( * ) FROM foo',
]
},
+ # single ? of unknown funcs do not unroll unless
+ # explicitly allowed (e.g. Like)
{
- equal => 1,
+ equal => 0,
statements => [
- 'SELECT foo FROM bar WHERE bar > (foo ?)',
- 'SELECT foo FROM bar WHERE bar > (foo( ? ))',
- 'SELECT foo FROM bar WHERE bar > (( foo (?) ))',
+ 'SELECT foo FROM bar WHERE bar > foo ?',
+ 'SELECT foo FROM bar WHERE bar > foo( ? )',
]
},
{
equal => 1,
statements => [
- 'SELECT foo FROM bar WHERE bar foo ?',
- 'SELECT foo FROM bar WHERE bar foo (?)',
- 'SELECT foo FROM bar WHERE bar foo( (?))',
+ 'SELECT foo FROM bar WHERE bar LIKE ?',
+ 'SELECT foo FROM bar WHERE bar LiKe (?)',
+ 'SELECT foo FROM bar WHERE bar lIkE( (?))',
]
},
- # not so about multival
+ # test multival
{
equal => 0,
statements => [