You are here

protected function DatabaseConnection_sqlsrv::replaceReservedCallback in Drupal driver for SQL Server and SQL Azure 7.2

Same name and namespace in other branches
  1. 7.3 sqlsrv/database.inc \DatabaseConnection_sqlsrv::replaceReservedCallback()
  2. 7 sqlsrv/database.inc \DatabaseConnection_sqlsrv::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

sqlsrv/database.inc, line 359
Database interface code for Microsoft SQL Server.

Class

DatabaseConnection_sqlsrv
Summary of DatabaseConnection_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);
}