Skip to content

Commit

Permalink
Merge 33ac18f into be21dde
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Jan 28, 2018
2 parents be21dde + 33ac18f commit d6d334c
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions lib/SQL/Abstract.pm
Original file line number Diff line number Diff line change
Expand Up @@ -464,17 +464,23 @@ sub select {
my $where = shift;
my $order = shift;

my($where_sql, @bind) = $self->where($where, $order);
my ($fields_sql, @bind) = $self->_select_fields($fields);

my $f = (ref $fields eq 'ARRAY') ? join ', ', map { $self->_quote($_) } @$fields
: $fields;
my $sql = join(' ', $self->_sqlcase('select'), $f,
my($where_sql, @where_bind) = $self->where($where, $order);
push @bind, @where_bind;
my $sql = join(' ', $self->_sqlcase('select'), $fields_sql,
$self->_sqlcase('from'), $table)
. $where_sql;

return wantarray ? ($sql, @bind) : $sql;
}

sub _select_fields {
my ($self, $fields) = @_;
return ref $fields eq 'ARRAY' ? join ', ', map { $self->_quote($_) } @$fields
: $fields;
}

#======================================================================
# DELETE
#======================================================================
Expand Down

0 comments on commit d6d334c

Please sign in to comment.