From: Matt S Trout Date: Tue, 26 Mar 2019 02:40:21 +0000 (+0000) Subject: extract IS/IS NOT X-Git-Tag: v2.000000~3^2~337 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=597f46cf1d100c95c61151c96250da4b63c4d5aa;p=dbsrgits%2FSQL-Abstract.git extract IS/IS NOT --- diff --git a/lib/SQL/Abstract.pm b/lib/SQL/Abstract.pm index cdba014..d3a1b35 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;