MySQL 9.0 發行說明
給定字串引數,此函數會產生適用於包含在 SQL 陳述式中的已加上引號的識別符。當要用作識別符的值是保留字或包含反引號 (`
) 字元時,這會很有用。
mysql> SELECT sys.quote_identifier('plain');
+-------------------------------+
| sys.quote_identifier('plain') |
+-------------------------------+
| `plain` |
+-------------------------------+
mysql> SELECT sys.quote_identifier('trick`ier');
+-----------------------------------+
| sys.quote_identifier('trick`ier') |
+-----------------------------------+
| `trick``ier` |
+-----------------------------------+
mysql> SELECT sys.quote_identifier('integer');
+---------------------------------+
| sys.quote_identifier('integer') |
+---------------------------------+
| `integer` |
+---------------------------------+