From: Matt S Trout Date: Fri, 29 Jul 2011 19:59:02 +0000 (+0000) Subject: default to unop/binop based on args X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6e055841e915c371077c5ff82268762668135a81;p=dbsrgits%2FData-Query.git default to unop/binop based on args --- diff --git a/lib/Data/Query/Renderer/SQL/Naive.pm b/lib/Data/Query/Renderer/SQL/Naive.pm index c20e610..0c6d242 100644 --- a/lib/Data/Query/Renderer/SQL/Naive.pm +++ b/lib/Data/Query/Renderer/SQL/Naive.pm @@ -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 {