PHP 7.4.0RC2 Released!

Session::quoteName

(No version information available, might only be in Git)

Session::quoteNameAdd quotes

Описание

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

A quoting function to escape SQL names and identifiers. It escapes the identifier given in accordance to the settings of the current connection. This escape function should not be used to escape values.

Список параметров

name

The string to quote.

Возвращаемые значения

The quoted string.

Примеры

Пример #1 mysql_xdevapi\Session::quoteName() example

<?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```"
add a note add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top