You are here

protected function Connection::replaceReservedCallback in Drupal driver for SQL Server and SQL Azure 3.1.x

Replace reserved words.

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

Parameters

mixed $matches: What is this?

Return value

string The match surrounded with brackets.

File

src/Driver/Database/sqlsrv/Connection.php, line 983

Class

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

Namespace

Drupal\sqlsrv\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);
}