From: Matt S Trout Date: Mon, 15 Apr 2019 02:18:45 +0000 (+0000) Subject: promote _join_parts to public method join_clauses X-Git-Tag: v2.000000~3^2~229 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6a22196d2599f91331ec0911cb2171fd134c1cfe;p=dbsrgits%2FSQL-Abstract.git promote _join_parts to public method join_clauses --- diff --git a/lib/SQL/Abstract.pm b/lib/SQL/Abstract.pm index 3541798..1ed3dc7 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_parts(' ', @parts); + return $self->join_clauses(' ', @parts); } sub _expand_insert_values { @@ -1188,7 +1188,7 @@ sub _render_op_andor { my @parts = grep length($_->[0]), map [ $self->render_aqt($_) ], @$args; return '' unless @parts; return @{$parts[0]} if @parts == 1; - my ($sql, @bind) = $self->_join_parts(' '.$self->_sqlcase($op).' ', @parts); + my ($sql, @bind) = $self->join_clauses(' '.$self->_sqlcase($op).' ', @parts); return '( '.$sql.' )', @bind; } @@ -1201,10 +1201,10 @@ sub _render_op_multop { ? ', ' : ' '.$self->_sqlcase(join ' ', split '_', $op).' ' ); - return $self->_join_parts($join, @parts); + return $self->join_clauses($join, @parts); } -sub _join_parts { +sub join_clauses { 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 3683f45..972963c 100644 --- a/lib/SQL/Abstract/Clauses.pm +++ b/lib/SQL/Abstract/Clauses.pm @@ -164,7 +164,7 @@ sub _render_statement { next unless defined($sql) and length($sql); push @parts, \@part; } - my ($sql, @bind) = $self->_join_parts(' ', @parts); + my ($sql, @bind) = $self->join_clauses(' ', @parts); return ( (our $Render_Top_Level ? $sql : '('.$sql.')'), @bind @@ -260,7 +260,7 @@ sub _expand_values { sub _render_values { my ($self, $values) = @_; - my ($v_sql, @bind) = $self->_join_parts( + my ($v_sql, @bind) = $self->join_clauses( ', ', 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 618356e..24a9dbf 100644 --- a/lib/SQL/Abstract/ExtraClauses.pm +++ b/lib/SQL/Abstract/ExtraClauses.pm @@ -113,7 +113,7 @@ sub _expand_join { sub _render_from_list { my ($self, $list) = @_; - return $self->_join_parts(', ', map [ $self->render_aqt($_) ], @$list); + return $self->join_clauses(', ', map [ $self->render_aqt($_) ], @$list); } sub _render_join { @@ -136,7 +136,7 @@ sub _render_join { [ $self->render_aqt($args->{using}) ], ) : ()), ); - return $self->_join_parts(' ', @parts); + return $self->join_clauses(' ', @parts); } sub _expand_op_as { @@ -149,15 +149,15 @@ sub _expand_op_as { sub _render_as { my ($self, $args) = @_; my ($thing, $as, @cols) = @$args; - return $self->_join_parts( + return $self->join_clauses( ' ', [ $self->render_aqt($thing) ], [ $self->render_aqt({ -keyword => 'as' }) ], (@cols - ? [ $self->_join_parts('', + ? [ $self->join_clauses('', [ $self->render_aqt($as) ], [ '(' ], - [ $self->_join_parts( + [ $self->join_clauses( ', ', map [ $self->render_aqt($_) ], @cols ) ],