sub _where_to_dq_ARRAYREF {
my ($self, $where, $logic) = @_;
- $logic = uc($logic || 'OR');
+ $logic = uc($logic || $self->{logic} || 'OR');
$logic eq 'AND' or $logic eq 'OR' or puke "unknown logic: $logic";
return unless @$where;
return $self->_op_to_dq(
NOT => ref($v) ? $self->_where_to_dq($v) : $self->_ident_to_dq($v)
);
+ } elsif ($op =~ /^(?:AND|OR|NEST)_?\d+/) {
+ die "Use of [and|or|nest]_N modifiers is no longer supported";
} else {
my @args = do {
if (ref($v) eq 'HASH' and keys(%$v) == 1 and (keys %$v)[0] =~ /^-(.*)/s) {
return $self->_literal_to_dq(
[ $self->${\$special_op->{handler}}($k, $op, $value) ]
);;
+ } elsif ($op =~ /^(?:AND|OR|NEST)_?\d+$/i) {
+ die "Use of [and|or|nest]_N modifiers is no longer supported";
}
(uc($op), $value);
} else {
return $self->_literal_to_dq(
$op eq '!=' ? $self->{sqltrue} : $self->{sqlfalse}
);
- } elsif (defined($rhs->[0]) and $rhs->[0] =~ /-(and|or)/i) {
+ } elsif (defined($rhs->[0]) and $rhs->[0] =~ /^-(and|or)$/i) {
return $self->_where_to_dq_ARRAYREF([
map +{ $k => { $op => $_ } }, @{$rhs}[1..$#$rhs]
], uc($1));
+ } elsif ($op =~ /^-(?:AND|OR|NEST)_?\d+/) {
+ die "Use of [and|or|nest]_N modifiers is no longer supported";
}
return $self->_where_to_dq_ARRAYREF([
map +{ $k => { $op => $_ } }, @$rhs
},
{
where => {a => 1, -nest => {b => 2, c => 3}},
- stmt => 'WHERE ( ( (b = ? AND c = ?) AND a = ? ) )',
+ stmt => 'WHERE ( ( b = ? AND c = ? AND a = ? ) )',
bind => [qw/2 3 1/],
},
{
where => {a => 1, -or => {-nest => {b => 2, c => 3}}},
- stmt => 'WHERE ( ( (b = ? AND c = ?) AND a = ? ) )',
+ stmt => 'WHERE ( ( b = ? AND c = ? AND a = ? ) )',
bind => [qw/2 3 1/],
},
{
},
{
where => [a => 1, -nest => {b => 2, c => 3}, -nest => [d => 4, e => 5]],
- stmt => 'WHERE ( ( a = ? OR ( b = ? AND c = ? ) OR ( d = ? OR e = ? ) ) )',
+ stmt => 'WHERE ( ( a = ? OR ( b = ? AND c = ? ) OR d = ? OR e = ? ) )',
bind => [qw/1 2 3 4 5/],
},
);