From: Matt S Trout Date: Mon, 1 Apr 2019 05:00:40 +0000 (+0000) Subject: remove - from expand keys X-Git-Tag: v1.90_01~270 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=def451518a3fcfa42429922879829365825495e8;p=dbsrgits%2FSQL-Abstract.git remove - from expand keys --- diff --git a/lib/SQL/Abstract.pm b/lib/SQL/Abstract.pm index a6bd096..2d9d883 100644 --- a/lib/SQL/Abstract.pm +++ b/lib/SQL/Abstract.pm @@ -193,21 +193,21 @@ sub new { $opt{expand_unary} = {}; $opt{expand} = { - -not => '_expand_not', - -bool => '_expand_bool', - -and => '_expand_op_andor', - -or => '_expand_op_andor', - -nest => '_expand_nest', - -bind => '_expand_bind', - -in => '_expand_in', - -not_in => '_expand_in', - -row => '_expand_row', - -between => '_expand_between', - -not_between => '_expand_between', - -op => '_expand_op', - (map +($_ => '_expand_op_is'), ('-is', '-is_not')), - -ident => '_expand_ident', - -value => '_expand_value', + not => '_expand_not', + bool => '_expand_bool', + and => '_expand_op_andor', + or => '_expand_op_andor', + nest => '_expand_nest', + bind => '_expand_bind', + in => '_expand_in', + not_in => '_expand_in', + row => '_expand_row', + between => '_expand_between', + not_between => '_expand_between', + op => '_expand_op', + (map +($_ => '_expand_op_is'), ('is', 'is_not')), + ident => '_expand_ident', + value => '_expand_value', }; $opt{expand_op} = { @@ -593,9 +593,6 @@ sub _expand_expr { belch 'Use of [and|or|nest]_N modifiers is deprecated and will be removed in SQLA v2.0. ' . "You probably wanted ...-and => [ $key => COND1, $key => COND2 ... ]"; } - if (my $exp = $self->{expand}{$key}) { - return $self->$exp($key, $value); - } return $self->_expand_hashpair($key, $value); } if (ref($expr) eq 'ARRAY') { @@ -707,6 +704,10 @@ sub _expand_hashpair_op { my $op = $self->_normalize_op($k); + if (my $exp = $self->{expand}{$op}) { + return $self->$exp($k, $v); + } + # Ops prefixed with -not_ get converted if (my ($rest) = $op =~/^not_(.*)$/) { @@ -1304,7 +1305,7 @@ sub _expand_order_by { return +{ -op => [ ',', @exp ] }; }; - local @{$self->{expand}}{qw(-asc -desc)} = (($expander) x 2); + local @{$self->{expand}}{qw(asc desc)} = (($expander) x 2); return $self->$expander(undef, $arg); }