Skip to content

Commit

Permalink
show how to combine different field types
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Jan 28, 2018
1 parent 67d9d63 commit 2158464
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/SQL/Abstract/Pg.pm
Expand Up @@ -171,7 +171,7 @@ sub _table {
=head1 NAME
SQL::Abstract::Pg - PostgreSQL Magic
SQL::Abstract::Pg - PostgreSQL
=head1 SYNOPSIS
Expand Down Expand Up @@ -221,16 +221,16 @@ This includes operations commonly referred to as C<upsert>.
The C<$fields> argument now also accepts array references containing array
references with field names and aliases, as well as array references containing
scalar references with literal SQL.
scalar references to pass literal SQL.
# "select foo as bar from some_table"
$abstract->select('some_table', [[foo => 'bar']]);
# "select foo, bar as baz, yada from some_table"
$abstract->select('some_table', ['foo', [bar => 'baz'], 'yada']);
# "select extract(epoch from foo) as foo from some_table"
$abstract->select('some_table', [\'extract(epoch from foo) as foo']);
# "select extract(epoch from foo) as foo, bar from some_table"
$abstract->select('some_table', [\'extract(epoch from foo) as foo', 'bar']);
=head2 JOIN
Expand Down Expand Up @@ -285,7 +285,7 @@ references to pass literal SQL are supported.
=head2 HAVING
The C<having> option can be used to generate C<SELECT> queries with C<HAVING>
clauses. Takes the same arguments as the C<$where> argument.
clauses, which takes the same values as the C<$where> argument.
# "select * from t group by a having b = 'c'"
$abstract->select('t', '*', undef, {group_by => ['a'], having => {b => 'c'}});
Expand Down

0 comments on commit 2158464

Please sign in to comment.