You are here

public function Connection::tablePrefix 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::tablePrefix()
  2. 4.0.x src/Driver/Database/sqlsrv/Connection.php \Drupal\sqlsrv\Driver\Database\sqlsrv\Connection::tablePrefix()
  3. 4.1.x src/Driver/Database/sqlsrv/Connection.php \Drupal\sqlsrv\Driver\Database\sqlsrv\Connection::tablePrefix()

Adding logic for temporary tables.

Overrides Connection::tablePrefix

1 call to Connection::tablePrefix()
Connection::getFullQualifiedTableName in src/Driver/Database/sqlsrv/Connection.php
Including schema name.

File

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

Class

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

Namespace

Drupal\sqlsrv\Driver\Database\sqlsrv

Code

public function tablePrefix($table = 'default') {
  if (isset($this->prefixes[$table])) {
    return $this->prefixes[$table];
  }
  $temp_prefix = '';
  if ($this
    ->isTemporaryTable($table)) {
    $temp_prefix = $this->tempTablePrefix;

    // 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;
    return implode('.', $default_parts);
  }
  return $this->prefixes['default'];
}