Skip to content

Commit

Permalink
handle SQL generation more consistently with SQL::Abstract
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Jan 26, 2018
1 parent db0022e commit 15bfe0d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/SQL/Abstract/Pg.pm
Expand Up @@ -23,7 +23,7 @@ sub _parse {
if (defined $options->{group_by}) {
croak qq{Unsupported group_by value "$options->{group_by}"}
unless ref $options->{group_by} eq 'SCALAR';
$sql .= ' GROUP BY ' . ${$options->{group_by}};
$sql .= $self->_sqlcase(' group by ') . ${$options->{group_by}};
}

# ORDER BY
Expand All @@ -33,21 +33,21 @@ sub _parse {

# LIMIT
if (defined $options->{limit}) {
$sql .= ' LIMIT ?';
$sql .= $self->_sqlcase(' limit ') . '?';
push @bind, $options->{limit};
}

# OFFSET
if (defined $options->{offset}) {
$sql .= ' OFFSET ?';
$sql .= $self->_sqlcase(' offset ') . '?';
push @bind, $options->{offset};
}

# FOR
if (defined $options->{for}) {
croak qq{Unsupported for value "$options->{for}"}
unless ref $options->{for} eq 'SCALAR';
$sql .= ' FOR ' . ${$options->{for}};
$sql .= $self->_sqlcase(' for ') . ${$options->{for}};
}

return $sql, @bind;
Expand Down

0 comments on commit 15bfe0d

Please sign in to comment.