Syntax
quote(str)
Purpose
You can use the QUOTE function to escape a string to produce a result that can be used as a properly escaped data value in an SQL statement.
By default, the function returns the string with single quotation marks (') added to both ends of the string.
For each backslash (\), single quotation mark ('), ASCII NUL value, and Control+Z, the function adds a backslash (\) before the character.
If the argument is NULL, the function returns the string 'NULL' without single quotation marks.
Examples
obclient> SELECT QUOTE('Don\'t!');
+------------------+
| QUOTE('Don\'t!') |
+------------------+
| 'Don\'t!' |
+------------------+
1 row in set
obclient> SELECT QUOTE(NULL);
+-------------+
| QUOTE(NULL) |
+-------------+
| NULL |
+-------------+
1 row in set
obclient> SELECT LENGTH(QUOTE(NULL));
+---------------------+
| LENGth(QUOTE(NULL)) |
+---------------------+
| 4 |
+---------------------+
1 row in set
