You are here

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

Same name and namespace in other branches
  1. 4.2.x src/Driver/Database/sqlsrv/Connection.php \Drupal\sqlsrv\Driver\Database\sqlsrv\Connection::setPrefix()
  2. 4.0.x src/Driver/Database/sqlsrv/Connection.php \Drupal\sqlsrv\Driver\Database\sqlsrv\Connection::setPrefix()
  3. 4.1.x src/Driver/Database/sqlsrv/Connection.php \Drupal\sqlsrv\Driver\Database\sqlsrv\Connection::setPrefix()

Adding logic for temporary tables.

Overrides Connection::setPrefix

File

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

Class

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

Namespace

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