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-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e90782e3e5e44cc2d65fe4ebdc14c1712152682f;p=scpubgit%2FQ-Branch.git fixup thingop_expander code and convert EC as --- diff --git a/lib/SQL/Abstract.pm b/lib/SQL/Abstract.pm index 4f136d6..a8b771f 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';