function Connection::quote
Same name in this branch
- 11.x core/lib/Drupal/Core/Database/Connection.php \Drupal\Core\Database\Connection::quote()
Same name and namespace in other branches
- 9 core/lib/Drupal/Core/Database/Connection.php \Drupal\Core\Database\Connection::quote()
- 8.9.x core/lib/Drupal/Core/Database/Connection.php \Drupal\Core\Database\Connection::quote()
- 10 core/lib/Drupal/Core/Database/Connection.php \Drupal\Core\Database\Connection::quote()
Quotes a string for use in a query.
Parameters
string $string: The string to be quoted.
int $parameter_type: (optional) Provides a data type hint for drivers that have alternate quoting styles. Defaults to \PDO::PARAM_STR.
Return value
string|bool A quoted string that is theoretically safe to pass into an SQL statement. Returns FALSE if the driver does not support quoting in this way.
Overrides Connection::quote
File
-
core/
modules/ mysqli/ src/ Driver/ Database/ mysqli/ Connection.php, line 166
Class
- Connection
- MySQLi implementation of \Drupal\Core\Database\Connection.
Namespace
Drupal\mysqli\Driver\Database\mysqliCode
public function quote($string, $parameter_type = \PDO::PARAM_STR) {
return "'" . $this->connection
->escape_string((string) $string) . "'";
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.