Connection::doEscape

protected Connection::doEscape($string)

Escape a string if needed.

Parameters

$string: The string to escape.

Return value

string The escaped string.

File

core/lib/Drupal/Core/Database/Driver/pgsql/Connection.php, line 252

Class

Connection
PostgreSQL implementation of \Drupal\Core\Database\Connection.

Namespace

Drupal\Core\Database\Driver\pgsql

Code

protected function doEscape($string) {
  // Quote identifier to make it case-sensitive.
  if (preg_match('/[A-Z]/', $string)) {
    $string = '"' . $string . '"';
  }
  elseif (in_array(strtolower($string), $this->postgresqlReservedKeyWords)) {
    // Quote the string for PostgreSQL reserved key words.
    $string = '"' . $string . '"';
  }
  return $string;
}
doc_Drupal
2016-10-29 08:55:46
Comments
Leave a Comment

Please login to continue.