You are here

protected function Connection::generateTemporaryTableName in Drupal driver for SQL Server and SQL Azure 8

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

Generates a temporary table name. Because we are using global temporary tables, these are visible between connections so we need to make sure that their names are as unique as possible to prevent collisions.

Return value

string A table name.

Overrides Connection::generateTemporaryTableName

1 call to Connection::generateTemporaryTableName()
Connection::queryTemporary in drivers/lib/Drupal/Driver/Database/sqlsrv/Connection.php
Runs a SELECT query and stores its results in a temporary table.

File

drivers/lib/Drupal/Driver/Database/sqlsrv/Connection.php, line 441
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 generateTemporaryTableName() {
  static $temp_key;
  if (!isset($temp_key)) {
    $temp_key = strtoupper(md5(uniqid(rand(), true)));
  }
  return "db_temp_" . $this->temporaryNameIndex++ . '_' . $temp_key;
}