Pg: Add escape_literal() and escape_identifier()

Didn't expect I'd ever need these, but they're useful for generating SQL
scripts.
This commit is contained in:
Yorhel 2025-04-07 13:45:24 +02:00
parent 3bf98e4d8f
commit b3281924d1
4 changed files with 41 additions and 0 deletions

View file

@ -123,6 +123,17 @@ Connection is dead or otherwise unusable.
=back
=item $conn->escape_literal($str)
Return an escaped version of C<$str> suitable for use as a string literal in an
SQL statement. You'll rarely need this, it's often better to pass data as bind
parameters instead.
=item $conn->escape_identifier($str)
Return an escaped version of C<$str> suitable for use as an identifier (name of
a table, column, function, etc) in an SQL statement.
=item $conn->cache($enable)
=item $conn->text_params($enable)