quote_identifier()函数
给定一个字符串参数,此函数将产生一个带引号的标识符,该标识符适合包含在SQL语句中。当用作标识符的值是保留字或包含反引号(`
)字符时,此功能很有用。
参量
in_identifier TEXT
:要引用的标识符。
返回值
一个TEXT
值。
例
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` | +--------------------------------- +