X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FData%2FQuery%2FRenderer%2FSQL%2FNaive.pm;h=9f18068daa89db4bb1acffd72fb7542c2d1e91a8;hb=f3f803da2c53988e0788850d4a91035cfecc96b9;hp=0b168a36c3e6dc6f92f865d228648f6dc0df86c6;hpb=54a4653740a48bc6963c9e333e59051de6969d6e;p=dbsrgits%2FData-Query.git diff --git a/lib/Data/Query/Renderer/SQL/Naive.pm b/lib/Data/Query/Renderer/SQL/Naive.pm index 0b168a3..9f18068 100644 --- a/lib/Data/Query/Renderer/SQL/Naive.pm +++ b/lib/Data/Query/Renderer/SQL/Naive.pm @@ -3,7 +3,7 @@ package Data::Query::Renderer::SQL::Naive; use strictures 1; use SQL::ReservedWords; use Data::Query::Constants qw( - DQ_IDENTIFIER DQ_OPERATOR DQ_VALUE DQ_JOIN DQ_ALIAS DQ_ORDER + DQ_IDENTIFIER DQ_OPERATOR DQ_VALUE DQ_JOIN DQ_ALIAS DQ_ORDER DQ_LITERAL ); sub new { @@ -203,8 +203,16 @@ sub _handle_op_type_in { sub _handle_op_type_between { my ($self, $op_name, $dq) = @_; - my ($lhs, $rhs1, $rhs2) = (map $self->_render($_), @{$dq->{args}}); - [ $lhs, $op_name, $rhs1, 'AND', $rhs2 ]; + my @args = @{$dq->{args}}; + if (@args == 3) { + my ($lhs, $rhs1, $rhs2) = (map $self->_render($_), @args); + [ $lhs, $op_name, $rhs1, 'AND', $rhs2 ]; + } elsif (@args == 2 and $args[1]->{type} eq DQ_LITERAL) { + my ($lhs, $rhs) = (map $self->_render($_), @args); + [ $lhs, $op_name, $rhs ]; + } else { + die "Invalid args for between: ${\scalar @args} given"; + } } sub _handle_op_type_apply {