my ($op, @opargs) = @$args;
+{ $node => [ $op, map $self->expand_expr($_), @opargs ] };
},
+ (map +($_ => '_expand_op_is'), ('-is', '-is_not')),
};
$opt{expand_op} = {
sub _expand_op_is {
my ($self, $op, $vv, $k) = @_;
+ $op =~ s/^-//;
+ ($k, $vv) = @$vv unless defined $k;
puke "$op can only take undef as argument"
if defined($vv)
and not (
and exists($vv->{-value})
and !defined($vv->{-value})
);
- return +{ -op => [ $op.'_null', $self->_expand_ident(-ident => $k) ] };
+ return +{ -op => [ $op.'_null', $self->expand_expr($k, -ident) ] };
}
sub _expand_between {
},
stmt => ' WHERE (x, y) IN ((?, ?), (?, ?))',
bind => [ 1..4 ],
- test => 'Complex IN',
+ test => 'Complex top-level -in',
+ },
+ {
+ where => { -is => [ 'bob', undef ] },
+ stmt => ' WHERE bob IS NULL',
+ bind => [],
+ test => 'Top level -is ok',
},
);