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-Tag: v2.000000~3^2~210 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=bfa2e351ce51ee4540ce90bf3e1925e844ad5893;p=dbsrgits%2FSQL-Abstract.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);