W3cubDocs

/Drupal 8

public function Connection::quote

public Connection::quote($string, $parameter_type = \PDO::PARAM_STR)

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.

See also

\PDO::quote()

File

core/lib/Drupal/Core/Database/Connection.php, line 1417

Class

Connection
Base Database API class.

Namespace

Drupal\Core\Database

Code

public function quote($string, $parameter_type = \PDO::PARAM_STR) {
  return $this->connection->quote($string, $parameter_type);
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Database!Connection.php/function/Connection::quote/8.1.x