You are here

public function Connection::__construct 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::__construct()
  2. 3.0.x drivers/lib/Drupal/Driver/Database/sqlsrv/Connection.php \Drupal\Driver\Database\sqlsrv\Connection::__construct()

Constructs a Connection object.

Overrides Connection::__construct

File

drivers/lib/Drupal/Driver/Database/sqlsrv/Connection.php, line 90
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

public function __construct(\PDO $connection, array $connection_options) {

  // Initialize settings.
  $this->driver_settings = DriverSettings::instanceFromSettings();

  // Initialize cache.
  $this->cache = new FastCache($connection_options['prefix']['default']);

  // Needs to happen before parent construct.
  $this->statementClass = Statement::class;
  parent::__construct($connection, $connection_options);

  // This driver defaults to transaction support, except if explicitly passed FALSE.
  $this->transactionSupport = !isset($connection_options['transactions']) || $connection_options['transactions'] !== FALSE;
  $this->transactionalDDLSupport = $this->transactionSupport;

  // Store connection options for future reference.
  $this->connectionOptions =& $connection_options;

  // Fetch the name of the user-bound schema. It is the schema that SQL Server
  // will use for non-qualified tables.
  $this
    ->schema()->defaultSchema = $this
    ->schema()
    ->GetDefaultSchema();
}