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 {
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 {