module PG::EscapeHelper

Extended Modules

Direct including types

Defined in:

pg/escape_helper.cr

Instance Method Summary

Instance Method Detail

def escape_identifier(str) #

#escape_identifier escapes a string for use as an SQL identifier, such as a table, column, or function name. This is useful when a user-supplied identifier might contain special characters that would otherwise not be interpreted as part of the identifier by the SQL parser, or when the identifier might contain upper case characters whose case should be preserved.


[View source]
def escape_literal(slice : Slice(UInt8)) #

#escape_literal escapes binary data suitable for use with the BYTEA type.


[View source]
def escape_literal(str) #

#escape_literal escapes a string for use within an SQL command. This is useful when inserting data values as literal constants in SQL commands. Certain characters (such as quotes and backslashes) must be escaped to prevent them from being interpreted specially by the SQL parser. PQescapeLiteral performs this operation.

Note that it is not necessary nor correct to do escaping when a data value is passed as a separate parameter in #exec


[View source]