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

1
2
3
4
5
6
7
8
9
10
11
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
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.