default to unop/binop based on args
Matt S Trout [Fri, 29 Jul 2011 19:59:02 +0000 (19:59 +0000)]
lib/Data/Query/Renderer/SQL/Naive.pm

index c20e610..0c6d242 100644 (file)
@@ -120,8 +120,14 @@ sub _render_operator {
   } elsif (my $meth = $self->can("_handle_op_special_${op_name}")) {
     return $self->$meth($dq);
   }
-  #die "Couldn't render operator ".$op->{$self->_operator_type};
-  $self->_handle_op_type_binop($op_name, $dq);
+  if (my $argc = @{$dq->{args}}) {
+    if ($argc == 1) {
+      return $self->_handle_op_type_unop($op_name, $dq);
+    } elsif ($argc == 2) {
+      return $self->_handle_op_type_binop($op_name, $dq);
+    }
+  }
+  die "Unsure how to handle ${op_name}";
 }
 
 sub _handle_op_type_binop {