public function Connection::__construct in Drupal driver for SQL Server and SQL Azure 3.1.x
Same name and namespace in other branches
- 4.2.x src/Driver/Database/sqlsrv/Connection.php \Drupal\sqlsrv\Driver\Database\sqlsrv\Connection::__construct()
- 4.0.x src/Driver/Database/sqlsrv/Connection.php \Drupal\sqlsrv\Driver\Database\sqlsrv\Connection::__construct()
- 4.1.x src/Driver/Database/sqlsrv/Connection.php \Drupal\sqlsrv\Driver\Database\sqlsrv\Connection::__construct()
Constructs a Connection object.
Parameters
\PDO $connection: An object of the PDO class representing a database connection.
array $connection_options: An array of options for the connection. May include the following:
- prefix
- namespace
- Other driver-specific options.
An 'extra_prefix' option may be present to allow BC for attaching per-table prefixes, but it is meant for internal use only.
Overrides Connection::__construct
File
- src/
Driver/ Database/ sqlsrv/ Connection.php, line 264
Class
- Connection
- Sqlsvr implementation of \Drupal\Core\Database\Connection.
Namespace
Drupal\sqlsrv\Driver\Database\sqlsrvCode
public function __construct(\PDO $connection, array $connection_options) {
$connection
->setAttribute(\PDO::ATTR_STRINGIFY_FETCHES, TRUE);
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;
}