From: Dagfinn Ilmari Mannsåker Date: Fri, 3 Jan 2014 15:04:21 +0000 (+0100) Subject: Throw exception for invalid BETWEEN args X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=052d09f06f2e6c05345c20250fdb5efad3d3a159;p=dbsrgits%2FSQL-Abstract.git Throw exception for invalid BETWEEN args --- diff --git a/lib/SQL/Abstract/Converter.pm b/lib/SQL/Abstract/Converter.pm index c4c8295..22ada4c 100644 --- a/lib/SQL/Abstract/Converter.pm +++ b/lib/SQL/Abstract/Converter.pm @@ -507,6 +507,8 @@ sub _where_hashpair_to_dq { $op, $self->_ident_to_dq($k), $self->_literal_to_dq($$rhs) ); } + die "Operator '$op' requires either an arrayref with two defined values or expressions, or a single literal scalarref/arrayref-ref" + if $op =~ /^(?:NOT )?BETWEEN$/ and (@$rhs != 2 or grep !defined, @$rhs); if (grep !defined, @$rhs) { my ($inop, $logic, $nullop) = $op =~ /^NOT/ ? (-not_in => AND => { '!=' => undef })