Revision history for SQL::Abstract
- Fix erroneous behavior of is_literal_value($) wrt { -ident => ... }
+ - Explicitly croak on top-level special ops (they didn't work anyway)
revision 1.79 2014-09-25
----------------------------
sub _where_unary_op {
my ($self, $op, $rhs) = @_;
+ # top level special ops are illegal in general
+ # this includes the -ident/-value ops (dual purpose unary and special)
+ puke "Illegal use of top-level '-$op'"
+ if ! defined $self->{_nested_func_lhs} and List::Util::first {$op =~ $_->{regex}} @{$self->{special_ops}};
+
if (my $op_entry = List::Util::first {$op =~ $_->{regex}} @{$self->{unary_ops}}) {
my $handler = $op_entry->{handler};
my ($sql, @bind) = $self->_SWITCH_refkind ($rhs, {
SCALAR => sub {
- puke "Illegal use of top-level '$op'"
+ puke "Illegal use of top-level '-$op'"
unless defined $self->{_nested_func_lhs};
return (
throws => qr/Argument passed to the 'IN' operator can not be undefined/,
test => '-in with undef argument',
},
+
+ {
+ where => { -in => [42] },
+ throws => qr/Illegal use of top-level '-in'/,
+ test => 'Top level -in',
+ },
+ {
+ where => { -between => [42, 69] },
+ throws => qr/Illegal use of top-level '-between'/,
+ test => 'Top level -between',
+ },
);
for my $case (@in_between_tests) {