From: Matt S Trout Date: Fri, 5 Apr 2019 18:48:37 +0000 (+0000) Subject: clean up select-hackery code X-Git-Tag: v2.000000~3^2~271 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=0c3c4c23630f89a4d3c500558e1cbf01535ecd62;p=dbsrgits%2FSQL-Abstract.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; }