(map +($_ => '_expand_op_is'), ('is', 'is_not')),
(map +($_ => __PACKAGE__->make_unop_expander("_expand_${_}")),
qw(ident value nest)),
+ bind => __PACKAGE__->make_unop_expander(sub { +{ -bind => $_[2] } }),
},
render => {
(map +($_, "_render_$_"),
});
}
if ($class->isa('SQL::Abstract::More')) {
+ my $orig = $opt{expand_op}{or};
$opt{expand_op}{or} = sub {
my ($self, $logop, $v, $k) = @_;
if ($k and ref($v) eq 'ARRAY') {
my ($type, $val) = @$v;
- my $op = $self->{cmp};
+ my $op;
if (
ref($type) eq 'HASH' and ref($val) eq 'HASH'
and keys %$type == 1 and keys %$val == 1
($val) = values %$val;
}
if ($self->is_bind_value_with_type(my $v = [ $type, $val ])) {
- return $self->_expand_hashpair($k, { $op, { -bind => $v } });
+ return $self->expand_expr(
+ { $k, map +($op ? { $op => $_ } : $_), { -bind => $v } }
+ );
}
}
- return $self->_expand_op_andor($logop, $v, $k);
+ return $self->$orig($logop, $v, $k);
};
$opt{render}{bind} = sub {
return [ '?', map +(ref($_->[0]) ? $_ : $_->[1]), $_[2] ]