You are here

protected function Connection::replaceReservedCallback in Drupal driver for SQL Server and SQL Azure 8.2

Same name and namespace in other branches
  1. 8 drivers/lib/Drupal/Driver/Database/sqlsrv/Connection.php \Drupal\Driver\Database\sqlsrv\Connection::replaceReservedCallback()
  2. 3.0.x drivers/lib/Drupal/Driver/Database/sqlsrv/Connection.php \Drupal\Driver\Database\sqlsrv\Connection::replaceReservedCallback()

This method gets called between 3,000 and 10,000 times on cold caches. Make sure it is simple and fast.

Parameters

mixed $matches:

Return value

mixed

File

drivers/lib/Drupal/Driver/Database/sqlsrv/Connection.php, line 356
Definition of Drupal\Driver\Database\sqlsrv\Connection

Class

Connection
Temporary tables: temporary table support is done by means of global temporary tables (#) to avoid the use of DIRECT QUERIES. You can enable and disable the use of direct queries with $this->driver_settings->defaultDirectQuery =…

Namespace

Drupal\Driver\Database\sqlsrv

Code

protected function replaceReservedCallback($matches) {
  if ($matches[1] !== '') {

    // Replace reserved words. We are not calling
    // quoteIdentifier() on purpose.
    return '[' . $matches[1] . ']';
  }

  // Let other value passthru.
  // by the logic of the regex above, this will always be the last match.
  return end($matches);
}