Pg: Set appropriate quote_identifier for $conn->Q()
This commit is contained in:
parent
81a3d3c608
commit
2083ab2a6f
3 changed files with 27 additions and 2 deletions
9
FU/Pg.pm
9
FU/Pg.pm
|
|
@ -10,7 +10,11 @@ package FU::Pg::conn {
|
|||
sub Q {
|
||||
require FU::SQL;
|
||||
my $s = shift;
|
||||
my($sql, $params) = FU::SQL::SQL(@_)->compile(placeholder_style => 'pg', in_style => 'pg');
|
||||
my($sql, $params) = FU::SQL::SQL(@_)->compile(
|
||||
placeholder_style => 'pg',
|
||||
in_style => 'pg',
|
||||
quote_identifier => sub { $s->conn->escape_identifier(@_) },
|
||||
);
|
||||
$s->q($sql, @$params);
|
||||
}
|
||||
|
||||
|
|
@ -208,7 +212,8 @@ used.
|
|||
=item $conn->Q(@args)
|
||||
|
||||
Same as C<< $conn->q() >> but uses L<FU::SQL> to construct the query and bind
|
||||
parameters.
|
||||
parameters. Uses the 'pg' C<in_style> and C<< $conn->escape_identifier() >> for
|
||||
identifier quoting.
|
||||
|
||||
=back
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue