Added "escapeLiteral" method - it is used to escape query arguments PQescapeLiteral
Added "escapeIdentifier" method - it is used to escape query identifiers (such as table name, column name and etc.) PQescapeIdentifier
Why do I add these methods?
Because the "escape" method doesn't escape values completely for their usage in SQL queries.
Ref from the libpq doc:
PQescapeStringConn escapes string literals, much like PQescapeLiteral. Unlike PQescapeLiteral, the caller is responsible for providing an appropriately sized buffer. Furthermore, PQescapeStringConn does not generate the single quotes that must surround PostgreSQL string literals; they should be provided in the SQL command that the result is inserted into.
Changes:
PQescapeLiteral
PQescapeIdentifier
Why do I add these methods?
Because the "escape" method doesn't escape values completely for their usage in SQL queries. Ref from the libpq doc:
PQescapeStringConn escapes string literals, much like PQescapeLiteral. Unlike PQescapeLiteral, the caller is responsible for providing an appropriately sized buffer. Furthermore, PQescapeStringConn does not generate the single quotes that must surround PostgreSQL string literals; they should be provided in the SQL command that the result is inserted into.
PHP code example
Output: