From: Matt S Trout Date: Thu, 18 Apr 2019 00:55:58 +0000 (+0000) Subject: rename join_clauses to join_query_parts X-Git-Tag: v1.90_01~191 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=0236f122f73090f9773bae7a6941a286c86ff889;p=dbsrgits%2FSQL-Abstract.git rename join_clauses to join_query_parts --- diff --git a/lib/SQL/Abstract.pm b/lib/SQL/Abstract.pm index 49e0da6..59ea97d 100644 --- a/lib/SQL/Abstract.pm +++ b/lib/SQL/Abstract.pm @@ -277,7 +277,7 @@ sub insert { push @parts, [ $self->_insert_returning($options) ]; } - return $self->join_clauses(' ', @parts); + return $self->join_query_parts(' ', @parts); } sub _expand_insert_values { @@ -1188,7 +1188,7 @@ sub _render_op_andor { my @parts = map [ $self->render_aqt($_) ], @$args; return '' unless @parts; return @{$parts[0]} if @parts == 1; - my ($sql, @bind) = $self->join_clauses(' '.$self->_sqlcase($op).' ', @parts); + my ($sql, @bind) = $self->join_query_parts(' '.$self->_sqlcase($op).' ', @parts); return '( '.$sql.' )', @bind; } @@ -1201,10 +1201,10 @@ sub _render_op_multop { ? ', ' : ' '.$self->_sqlcase(join ' ', split '_', $op).' ' ); - return $self->join_clauses($join, @parts); + return $self->join_query_parts($join, @parts); } -sub join_clauses { +sub join_query_parts { my ($self, $join, @parts) = @_; return ( join($join, map $_->[0], @parts), diff --git a/lib/SQL/Abstract/Clauses.pm b/lib/SQL/Abstract/Clauses.pm index 2dd9c4e..7b4cc7e 100644 --- a/lib/SQL/Abstract/Clauses.pm +++ b/lib/SQL/Abstract/Clauses.pm @@ -168,7 +168,7 @@ sub _render_statement { next unless defined($sql) and length($sql); push @parts, \@part; } - my ($sql, @bind) = $self->join_clauses(' ', @parts); + my ($sql, @bind) = $self->join_query_parts(' ', @parts); return ( (our $Render_Top_Level ? $sql : '('.$sql.')'), @bind @@ -264,7 +264,7 @@ sub _expand_values { sub _render_values { my ($self, undef, $values) = @_; - my ($v_sql, @bind) = $self->join_clauses( + my ($v_sql, @bind) = $self->join_query_parts( ', ', map [ $self->render_aqt($_) ], ref($values) eq 'ARRAY' ? @$values : $values diff --git a/lib/SQL/Abstract/ExtraClauses.pm b/lib/SQL/Abstract/ExtraClauses.pm index eaac9c1..9878941 100644 --- a/lib/SQL/Abstract/ExtraClauses.pm +++ b/lib/SQL/Abstract/ExtraClauses.pm @@ -92,7 +92,7 @@ sub register_defaults { $self->renderer($_ => sub { my ($self, $setop, $args) = @_; - $self->join_clauses( + $self->join_query_parts( ' '.$self->format_keyword(join '_', $setop, ($args->{type}||())).' ', map [ $self->render_aqt($_) ], @{$args->{queries}} ); @@ -140,17 +140,17 @@ sub register_defaults { $self->clause_expander('select.with_recursive', $with_expander); $self->clause_renderer('select.with' => sub { my ($self, undef, $with) = @_; - my $q_part = [ $self->join_clauses(', ', + my $q_part = [ $self->join_query_parts(', ', map { my ($alias, $query) = @$_; - [ $self->join_clauses(' ', + [ $self->join_query_parts(' ', [ $self->_render_alias($alias) ], [ $self->format_keyword('as') ], [ $self->render_aqt($query) ], ) ] } @{$with->{queries}} ) ]; - return $self->join_clauses(' ', + return $self->join_query_parts(' ', [ $self->format_keyword(join '_', 'with', ($with->{type}||'')) ], $q_part, ); @@ -215,7 +215,7 @@ sub _expand_join { sub _render_from_list { my ($self, undef, $list) = @_; - return $self->join_clauses(', ', map [ $self->render_aqt($_) ], @$list); + return $self->join_query_parts(', ', map [ $self->render_aqt($_) ], @$list); } sub _render_join { @@ -236,7 +236,7 @@ sub _render_join { [ $self->render_aqt($args->{using}) ], ) : ()), ); - return $self->join_clauses(' ', @parts); + return $self->join_query_parts(' ', @parts); } sub _expand_op_as { @@ -249,7 +249,7 @@ sub _expand_op_as { sub _render_as { my ($self, undef, $args) = @_; my ($thing, @alias) = @$args; - return $self->join_clauses( + return $self->join_query_parts( ' ', [ $self->render_aqt($thing) ], [ $self->format_keyword('as') ], @@ -261,10 +261,10 @@ sub _render_alias { my ($self, $args) = @_; my ($as, @cols) = @$args; return (@cols - ? $self->join_clauses('', + ? $self->join_query_parts('', [ $self->render_aqt($as) ], [ '(' ], - [ $self->join_clauses( + [ $self->join_query_parts( ', ', map [ $self->render_aqt($_) ], @cols ) ],