From: Matt S Trout Date: Tue, 18 Sep 2018 01:24:08 +0000 (+0000) Subject: RETURNING using render/expand X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ff96fdd4393f62c96b87602b3923eac4d55f80ec;p=scpubgit%2FQ-Branch.git RETURNING using render/expand --- diff --git a/lib/SQL/Abstract.pm b/lib/SQL/Abstract.pm index 52a41d0..7791733 100644 --- a/lib/SQL/Abstract.pm +++ b/lib/SQL/Abstract.pm @@ -224,12 +224,12 @@ sub _returning { my $f = $options->{returning}; - my $fieldlist = $self->_SWITCH_refkind($f, { - ARRAYREF => sub {join ', ', map { $self->_quote($_) } @$f;}, - SCALAR => sub {$self->_quote($f)}, - SCALARREF => sub {$$f}, - }); - return $self->_sqlcase(' returning ') . $fieldlist; + my ($sql, @bind) = $self->_render_expr( + $self->_expand_maybe_list_expr($f, undef, -ident) + ); + return wantarray + ? $self->_sqlcase(' returning ') . $sql + : ($self->_sqlcase(' returning ').$sql, @bind); } sub _insert_HASHREF { # explicit list of fields and then values