From: Matt S Trout Date: Tue, 11 Sep 2018 23:14:43 +0000 (+0000) Subject: eliminate IS special op usage X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=87c8e45b732d271cc6a2a60c6c7e72d174e15ad3;p=scpubgit%2FQ-Branch.git eliminate IS special op usage --- diff --git a/lib/SQL/Abstract.pm b/lib/SQL/Abstract.pm index c9c89bf..d83da8c 100644 --- a/lib/SQL/Abstract.pm +++ b/lib/SQL/Abstract.pm @@ -41,7 +41,7 @@ my @BUILTIN_SPECIAL_OPS = ( {regex => qr/^ (?: not \s )? in $/ix, handler => sub { die "NOPE" }}, {regex => qr/^ ident $/ix, handler => sub { die "NOPE" }}, {regex => qr/^ value $/ix, handler => sub { die "NOPE" }}, - {regex => qr/^ is (?: \s+ not )? $/ix, handler => '_where_field_IS'}, + {regex => qr/^ is (?: \s+ not )? $/ix, handler => sub { die "NOPE" }}, ); # unaryish operators - key maps to handler @@ -709,6 +709,17 @@ sub _expand_expr_hashpair { { -bind => [ $k, $vv ] } ] }; } + if ($vk =~ /^is(?:[ _]not)?$/) { + puke "$vk can only take undef as argument" + if defined($vv) + and not ( + ref($vv) eq 'HASH' + and exists($vv->{-value}) + and !defined($vv->{-value}) + ); + $vk =~ s/_/ /g; + return +{ -op => [ $vk.' null', { -ident => $k } ] }; + } } if (ref($v) eq 'ARRAY') { return $self->{sqlfalse} unless @$v;