From: Matt S Trout Date: Sat, 28 Sep 2019 17:06:34 +0000 (+0000) Subject: remove a bunch more pointless expanders X-Git-Tag: v2.000000~3^2~103 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9c7fbcec1a40f7a6764746ba9ab399335a227b84;p=dbsrgits%2FSQL-Abstract.git remove a bunch more pointless expanders --- diff --git a/lib/SQL/Abstract.pm b/lib/SQL/Abstract.pm index ec08762..12ec5d3 100644 --- a/lib/SQL/Abstract.pm +++ b/lib/SQL/Abstract.pm @@ -139,19 +139,11 @@ sub is_plain_value ($) { our %Defaults = ( 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')), func => '_expand_func', values => '_expand_values', }, @@ -1049,7 +1041,11 @@ sub _expand_hashpair_op { return { $k => $v }; } - my $type = $self->{unknown_unop_always_func} ? -func : -op; + my $type = ( + $self->{unknown_unop_always_func} && !$self->{render_op}{$op} + ? -func + : -op + ); { # Old SQLA compat @@ -1059,7 +1055,10 @@ sub _expand_hashpair_op { and (keys %$v)[0] =~ /^-/ ) { $type = ( - (List::Util::first { $op =~ $_->{regex} } @{$self->{special_ops}}) + ( + (List::Util::first { $op =~ $_->{regex} } @{$self->{special_ops}}) + or $self->{render_op}{$op} + ) ? -op : -func ) @@ -1205,10 +1204,6 @@ sub _expand_value { +{ -bind => [ our $Cur_Col_Meta, $_[2] ] }; } -sub _expand_not { - +{ -op => [ 'not', $_[0]->_expand_expr($_[2]) ] }; -} - sub _expand_row { my ($self, undef, $args) = @_; +{ -row => [ map $self->expand_expr($_), @$args ] };