From: Matt S Trout Date: Thu, 18 Apr 2019 01:56:10 +0000 (+0000) Subject: row and between X-Git-Tag: v1.90_01~186 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=904e498937a780df5b185b55798a4178fa7ff60a;p=dbsrgits%2FSQL-Abstract.git row and between --- diff --git a/lib/SQL/Abstract.pm b/lib/SQL/Abstract.pm index b3aaa20..61aad52 100644 --- a/lib/SQL/Abstract.pm +++ b/lib/SQL/Abstract.pm @@ -1076,7 +1076,7 @@ sub _render_ident { sub _render_row { my ($self, undef, $values) = @_; my ($sql, @bind) = $self->_render_op(undef, [ ',', @$values ]); - return "($sql)", @bind; + return $self->join_query_parts('', [ '(' ], [ $sql, @bind ], [ ')' ]); } sub _render_func { @@ -1139,25 +1139,22 @@ sub _render_op { sub _render_op_between { my ($self, $op, $args) = @_; my ($left, $low, $high) = @$args; - my ($rhsql, @rhbind) = do { + my @rh = do { if (@$args == 2) { puke "Single arg to between must be a literal" unless $low->{-literal}; - @{$low->{-literal}} + $low; } else { - my ($l, $h) = map [ $self->render_aqt($_) ], $low, $high; - (join(' ', $l->[0], $self->_sqlcase('and'), $h->[0]), - @{$l}[1..$#$l], @{$h}[1..$#$h]) + +($low, [ $self->_sqlcase('and') ], $high); } }; my ($lhsql, @lhbind) = $self->render_aqt($left); - return ( - join(' ', - '(', $lhsql, - $self->_sqlcase(join ' ', split '_', $op), - $rhsql, ')' - ), - @lhbind, @rhbind + return $self->join_query_parts(' ', + [ '(' ], + $left, + [ $self->_sqlcase(join ' ', split '_', $op) ], + @rh, + [ ')' ], ); }