You are here

protected function Connection::setPrefix in Drupal driver for SQL Server and SQL Azure 3.0.x

Adding logic for temporary tables.

Overrides Connection::setPrefix

File

drivers/lib/Drupal/Driver/Database/sqlsrv/Connection.php, line 751

Class

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

Namespace

Drupal\Driver\Database\sqlsrv

Code

protected function setPrefix($prefix) {
  parent::setPrefix($prefix);

  // Add this to the front of the array so it is done before
  // the default action.
  array_unshift($this->prefixSearch, '{db_temporary_');

  // If there is a period in the prefix, apply the temp prefix to the final
  // piece.
  $default_parts = explode('.', $this->prefixes['default']);
  $table_part = array_pop($default_parts);
  $default_parts[] = $this->tempTablePrefix . $table_part;
  $full_prefix = implode('.', $default_parts);
  array_unshift($this->prefixReplace, $full_prefix . 'db_temporary_');
}