From: Matt S Trout Date: Thu, 18 Apr 2019 01:14:58 +0000 (+0000) Subject: make the legacy convert feature its own node X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=38c5397d5e9cb9be87c07cae532afef6437cf4eb;hp=5e4aaea347e2546a471f855f994106b5f345c6d6;p=scpubgit%2FQ-Branch.git make the legacy convert feature its own node --- diff --git a/lib/SQL/Abstract/Clauses.pm b/lib/SQL/Abstract/Clauses.pm index 9684ad9..d404077 100644 --- a/lib/SQL/Abstract/Clauses.pm +++ b/lib/SQL/Abstract/Clauses.pm @@ -74,6 +74,11 @@ sub register_defaults { $self->{expand}{exists} = sub { $_[0]->_expand_op(undef, [ exists => $_[2] ]); }; + $self->{render}{convert_where} = sub { + my $self = shift; + local $self->{convert_where} = $self->{convert}; + $self->render_aqt($_[0]); + }; return $self; } @@ -89,7 +94,8 @@ sub _expand_select_clause_from { sub _expand_select_clause_where { my ($self, undef, $where) = @_; - +(where => $self->expand_expr($where)); + my $exp = $self->expand_expr($where); + +(where => ($self->{convert} ? { -convert_where => $exp } : $exp)); } sub _expand_select_clause_order_by { @@ -153,7 +159,6 @@ sub _render_statement { my @parts; foreach my $clause (@{$self->{clauses_of}{$type}}) { next unless my $clause_expr = $args->{$clause}; - local $self->{convert_where} = $self->{convert} if $clause eq 'where'; my @part = do { if (my $rdr = $self->{render_clause}{"${type}.${clause}"}) { $self->$rdr($clause, $clause_expr);