string.encodeForSQL()

edit

Encodes the given string for safe output in a query to reduce the risk of SQL Injection attacks.

Deprecated: this function is deprecated and not recommended. It still works, but escaping characters cannot protect a query as reliably as bound parameters do. Use query parameters instead, see <cfqueryparam> and the params argument of QueryExecute().

The underlying ESAPI library removed this function in version 2.7.0 due to security concerns. The Lucee ESAPI extension keeps its own implementation, so existing code is not affected, but new code should not use it.

string.encodeForSQL( dialect=string, canonicalize=boolean )

Returns: String

Argument Description
dialect
string, required
edit

SQL dialect used to encode, possible values are: * db2 * mysql_ansi * mysql * oracle

canonicalize
boolean, optional
edit

If set to true, canonicalization happens before encoding. If set to false, the given input string will just be encoded. The default value for canonicalize is false. When this parameter is not specified, canonicalization will not happen. By default, when canonicalization is performed, both mixed and multiple encodings will be allowed. To use any other combinations you should canonicalize using canonicalize method and then do encoding.

Examples

There are currently no examples for this function

See also