re-engineer ident
Matt S Trout [Thu, 21 Mar 2019 05:08:58 +0000 (05:08 +0000)]
lib/SQL/Abstract.pm

index ee02d63..5c2b71c 100644 (file)
@@ -200,6 +200,14 @@ sub new {
     'not between' => '_expand_between',
     'in' => '_expand_in',
     'not in' => '_expand_in',
+    'ident' => sub {
+      my ($self, $op, $arg, $k) = @_;
+      return +{ -op => [
+        $self->{cmp},
+        $self->_expand_ident(-ident => $k),
+        $self->_expand_expr({ '-'.$op => $arg }),
+      ] };
+    },
   };
 
   $opt{render} = {
@@ -686,13 +694,6 @@ sub _expand_expr_hashpair {
     if (my $x = $self->{expand_op}{$op}) {
       return $self->$x($op, $vv, $k);
     }
-    if ($op eq 'ident') {
-      return +{ -op => [
-        $self->{cmp},
-        $self->_expand_ident(-ident => $k),
-        $self->_expand_expr({ -ident => $vv }),
-      ] };
-    }
     if ($op eq 'value') {
       return $self->_expand_expr({ $k, undef }) unless defined($vv);
       return +{ -op => [