From: Matt S Trout Date: Tue, 1 Oct 2019 01:22:03 +0000 (+0000) Subject: fixup thingop_expander code and convert EC as X-Git-Tag: v2.000000~3^2~68 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e1c7c0b54feb21d735c09feb586b0182cb95b3d6;p=dbsrgits%2FSQL-Abstract.git fixup thingop_expander code and convert EC as --- diff --git a/lib/SQL/Abstract.pm b/lib/SQL/Abstract.pm index cd4fe3b..e27c02d 100644 --- a/lib/SQL/Abstract.pm +++ b/lib/SQL/Abstract.pm @@ -367,7 +367,7 @@ BEGIN { my (\$self, \@args) = \@_; while (my (\$this_key, \$this_value) = splice(\@args, 0, 2)) { \$self->_ext_rw( - op => \$this_key, + expand_op => \$this_key, \$self->make_${singular}(\$this_value), ); } diff --git a/lib/SQL/Abstract/ExtraClauses.pm b/lib/SQL/Abstract/ExtraClauses.pm index 57faed7..cb64a5e 100644 --- a/lib/SQL/Abstract/ExtraClauses.pm +++ b/lib/SQL/Abstract/ExtraClauses.pm @@ -41,8 +41,7 @@ sub apply_to { $sqla->expander($thing => $self->cb("_expand_${thing}")) ->renderer($thing => $self->cb("_render_${thing}")) } - $sqla->op_expander(as => $self->cb('_expand_op_as')); - $sqla->expander(as => $self->cb('_expand_op_as')); + $sqla->binop_expander(as => $self->cb('_expand_op_as')); $sqla->renderer(as => $self->cb('_render_as')); $sqla->expander(alias => $self->cb('_expand_alias')); $sqla->renderer(alias => $self->cb('_render_alias')); @@ -204,7 +203,6 @@ sub _render_join { sub _expand_op_as { my ($self, undef, $vv, $k) = @_; my @vv = (ref($vv) eq 'ARRAY' ? @$vv : $vv); - $k ||= shift @vv; my $ik = $self->expand_expr($k, -ident); return +{ -as => [ $ik, $self->expand_expr($vv[0], -alias) ] } if @vv == 1 and ref($vv[0]) eq 'HASH';