From: Matt S Trout Date: Fri, 19 Apr 2019 02:09:52 +0000 (+0000) Subject: port clause renderers to arrayref convention X-Git-Tag: v2.000000~3^2~191 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=0234598555456b3b6dec345c78425ca4e030c271;p=dbsrgits%2FSQL-Abstract.git port clause renderers to arrayref convention --- diff --git a/lib/SQL/Abstract/Clauses.pm b/lib/SQL/Abstract/Clauses.pm index 1d1f05e..ca41c07 100644 --- a/lib/SQL/Abstract/Clauses.pm +++ b/lib/SQL/Abstract/Clauses.pm @@ -49,14 +49,14 @@ sub register_defaults { $self->{expand_clause}{'insert.into'} = '_expand_insert_clause_target'; $self->{expand_clause}{'insert.values'} = '_expand_insert_clause_from'; $self->{render_clause}{'insert.fields'} = sub { - return $_[0]->render_aqt($_[2]); + return @{ $_[0]->render_aqt($_[2]) }; }; $self->{render_clause}{'insert.target'} = sub { my ($self, undef, $from) = @_; $self->join_query_parts(' ', $self->format_keyword('insert into'), $from); }; $self->{render_clause}{'insert.from'} = sub { - return $_[0]->render_aqt($_[2], 1); + return @{ $_[0]->render_aqt($_[2], 1) }; }; $self->{expand}{values} = '_expand_values'; $self->{render}{values} = '_render_values'; @@ -66,7 +66,7 @@ sub register_defaults { $self->{render}{convert_where} = sub { my $self = shift; local $self->{convert_where} = $self->{convert}; - $self->render_aqt($_[1]); + @{ $self->render_aqt($_[1]) }; }; return $self; } @@ -152,7 +152,7 @@ sub _render_statement { if (my $rdr = $self->{render_clause}{"${type}.${clause}"}) { $self->$rdr($clause, $clause_expr); } else { - my ($clause_sql, @bind) = $self->render_aqt($clause_expr, 1); + my ($clause_sql, @bind) = @{ $self->render_aqt($clause_expr, 1) }; my $sql = join ' ', $self->_sqlcase(join ' ', split '_', $clause), $clause_sql; @@ -176,9 +176,9 @@ sub render_aqt { sub render_statement { my ($self, $expr, $default_scalar_to) = @_; - my ($sql, @bind) = $self->render_aqt( + my ($sql, @bind) = @{ $self->render_aqt( $self->expand_expr($expr, $default_scalar_to), 1 - ); + ) }; return (wantarray ? ($sql, @bind) : $sql); } diff --git a/lib/SQL/Abstract/ExtraClauses.pm b/lib/SQL/Abstract/ExtraClauses.pm index f7da280..9eb04a8 100644 --- a/lib/SQL/Abstract/ExtraClauses.pm +++ b/lib/SQL/Abstract/ExtraClauses.pm @@ -87,7 +87,7 @@ sub register_defaults { $self->clause_renderer('select.setop' => sub { my ($self, undef, $setop) = @_; - $self->render_aqt($setop); + @{ $self->render_aqt($setop) }; }); $self->renderer($_ => sub { @@ -144,14 +144,14 @@ sub register_defaults { map { my ($alias, $query) = @$_; [ $self->join_query_parts(' ', - [ $self->_render_alias($alias) ], - [ $self->format_keyword('as') ], + $self->_render_alias($alias), + $self->format_keyword('as'), $query, ) ] } @{$with->{queries}} ) ]; return $self->join_query_parts(' ', - [ $self->format_keyword(join '_', 'with', ($with->{type}||'')) ], + $self->format_keyword(join '_', 'with', ($with->{type}||'')), $q_part, ); }); @@ -247,9 +247,9 @@ sub _render_as { my ($thing, @alias) = @$args; return $self->join_query_parts( ' ', - [ $self->render_aqt($thing) ], - [ $self->format_keyword('as') ], - [ $self->_render_alias(\@alias) ], + $self->render_aqt($thing), + $self->format_keyword('as'), + $self->_render_alias(\@alias), ); }