From: Matt S Trout Date: Fri, 5 Apr 2019 18:48:37 +0000 (+0000) Subject: clean up select-hackery code X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8e6988ce58468a778753310319cbb04826d66999;p=scpubgit%2FQ-Branch.git clean up select-hackery code --- diff --git a/lib/SQL/Abstract/Clauses.pm b/lib/SQL/Abstract/Clauses.pm index 86b468f..a8e5848 100644 --- a/lib/SQL/Abstract/Clauses.pm +++ b/lib/SQL/Abstract/Clauses.pm @@ -60,11 +60,13 @@ sub select { my ($self, @args) = @_; my %clauses; @clauses{qw(from select where order_by)} = @args; + # This oddity is to literalify since historically SQLA doesn't quote - # a single identifier argument, and the .'' is to copy $clauses{select} - # before taking a reference to it to avoid making a reference loop - $clauses{select}= \(($clauses{select}||'*').'') - unless ref($clauses{select}); + # a single identifier argument, so we convert it into a literal + + unless (ref(my $select = $clauses{select}||'*')) { + $clauses{select} = \$select; + } my ($sql, @bind) = $self->render_expr({ -select => \%clauses }); return wantarray ? ($sql, @bind) : $sql; }