Session::quoteName

クォートを追加する

説明

public string mysql_xdevapi\Session::quoteName(string $name)

SQL の名前や識別子をエスケープするためのクォート関数です。 現在の接続の設定に従って、与えられた識別子をエスケープします。 このエスケープ関数は、値のエスケープに使うべきではありません。

パラメータ

name

クォートする文字列

戻り値

クォートされた文字列を返します。

例1 mysql_xdevapi\Session::quoteName の例

<?php
$session 
mysql_xdevapi\getSession("mysqlx://user:password@localhost");

$first "MySQL's test";
var_dump($first);
var_dump($session->quoteName($first));

$second 'Another `test` "like" `this`';
var_dump($second);
var_dump($session->quoteName($second));
?>

上の例の出力は、 たとえば以下のようになります。

string(12) "MySQL's test"
string(14) "`MySQL's test`"

string(28) "Another `test` "like" `this`"
string(34) "`Another ``test`` "like" ``this```"