From: Matt S Trout Date: Tue, 26 Mar 2019 02:40:21 +0000 (+0000) Subject: extract IS/IS NOT X-Git-Tag: v1.90_01~316 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f49b02a06036264e84883d58e0bad3e9cba8ff90;p=dbsrgits%2FSQL-Abstract.git extract IS/IS NOT --- diff --git a/lib/SQL/Abstract.pm b/lib/SQL/Abstract.pm index 64b196a..b360674 100644 --- a/lib/SQL/Abstract.pm +++ b/lib/SQL/Abstract.pm @@ -200,8 +200,8 @@ sub new { 'in' => '_expand_in', 'not in' => '_expand_in', 'nest' => '_expand_nest', - (map +($_ => '_expand_op_andor'), - qw(and or)), + (map +($_ => '_expand_op_andor'), ('and', 'or')), + (map +($_ => '_expand_op_is'), ('is', 'is not')), }; # placeholder for _expand_unop system @@ -909,6 +909,18 @@ sub _expand_op_andor { die "notreached"; } +sub _expand_op_is { + my ($self, $op, $vv, $k) = @_; + puke "$op can only take undef as argument" + if defined($vv) + and not ( + ref($vv) eq 'HASH' + and exists($vv->{-value}) + and !defined($vv->{-value}) + ); + return +{ -op => [ $op.' null', $self->_expand_ident(-ident => $k) ] }; +} + sub _expand_between { my ($self, $op, $vv, $k) = @_; local our $Cur_Col_Meta = $k;