From: Matt S Trout Date: Thu, 18 Apr 2019 01:07:17 +0000 (+0000) Subject: more use cleanup, add hashref to join_sql_parts X-Git-Tag: v1.90_01~190 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=5e4aaea347e2546a471f855f994106b5f345c6d6;p=dbsrgits%2FSQL-Abstract.git more use cleanup, add hashref to join_sql_parts --- diff --git a/lib/SQL/Abstract.pm b/lib/SQL/Abstract.pm index 59ea97d..2ef8f4e 100644 --- a/lib/SQL/Abstract.pm +++ b/lib/SQL/Abstract.pm @@ -1206,9 +1206,11 @@ sub _render_op_multop { sub join_query_parts { my ($self, $join, @parts) = @_; + my @final = map +(ref($_) eq 'HASH' ? [ $self->render_aqt($_) ] : $_), + @parts; return ( - join($join, map $_->[0], @parts), - (wantarray ? (map @{$_}[1..$#$_], @parts) : ()), + join($join, map $_->[0], @final), + (wantarray ? (map @{$_}[1..$#$_], @final) : ()), ); } diff --git a/lib/SQL/Abstract/Clauses.pm b/lib/SQL/Abstract/Clauses.pm index 7b4cc7e..9684ad9 100644 --- a/lib/SQL/Abstract/Clauses.pm +++ b/lib/SQL/Abstract/Clauses.pm @@ -154,7 +154,7 @@ sub _render_statement { 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 ($sql) = my @part = do { + my @part = do { if (my $rdr = $self->{render_clause}{"${type}.${clause}"}) { $self->$rdr($clause, $clause_expr); } else { @@ -165,7 +165,6 @@ sub _render_statement { ($sql, @bind); } }; - next unless defined($sql) and length($sql); push @parts, \@part; } my ($sql, @bind) = $self->join_query_parts(' ', @parts);