function Connection::__construct
Same name in this branch
- 8.9.x core/modules/system/tests/modules/driver_test/src/Driver/Database/DrivertestMysqlDeprecatedVersion/Connection.php \Drupal\driver_test\Driver\Database\DrivertestMysqlDeprecatedVersion\Connection::__construct()
- 8.9.x core/lib/Drupal/Core/Database/Driver/sqlite/Connection.php \Drupal\Core\Database\Driver\sqlite\Connection::__construct()
- 8.9.x core/lib/Drupal/Core/Database/Driver/mysql/Connection.php \Drupal\Core\Database\Driver\mysql\Connection::__construct()
- 8.9.x core/lib/Drupal/Core/Database/Connection.php \Drupal\Core\Database\Connection::__construct()
Same name in other branches
- 9 core/modules/sqlite/src/Driver/Database/sqlite/Connection.php \Drupal\sqlite\Driver\Database\sqlite\Connection::__construct()
- 9 core/modules/mysql/src/Driver/Database/mysql/Connection.php \Drupal\mysql\Driver\Database\mysql\Connection::__construct()
- 9 core/modules/pgsql/src/Driver/Database/pgsql/Connection.php \Drupal\pgsql\Driver\Database\pgsql\Connection::__construct()
- 9 core/lib/Drupal/Core/Database/Connection.php \Drupal\Core\Database\Connection::__construct()
- 10 core/modules/sqlite/src/Driver/Database/sqlite/Connection.php \Drupal\sqlite\Driver\Database\sqlite\Connection::__construct()
- 10 core/modules/mysql/src/Driver/Database/mysql/Connection.php \Drupal\mysql\Driver\Database\mysql\Connection::__construct()
- 10 core/modules/pgsql/src/Driver/Database/pgsql/Connection.php \Drupal\pgsql\Driver\Database\pgsql\Connection::__construct()
- 10 core/lib/Drupal/Core/Database/Connection.php \Drupal\Core\Database\Connection::__construct()
- 11.x core/modules/sqlite/src/Driver/Database/sqlite/Connection.php \Drupal\sqlite\Driver\Database\sqlite\Connection::__construct()
- 11.x core/modules/mysql/src/Driver/Database/mysql/Connection.php \Drupal\mysql\Driver\Database\mysql\Connection::__construct()
- 11.x core/modules/pgsql/src/Driver/Database/pgsql/Connection.php \Drupal\pgsql\Driver\Database\pgsql\Connection::__construct()
- 11.x core/lib/Drupal/Core/Database/Connection.php \Drupal\Core\Database\Connection::__construct()
Constructs a connection object.
Overrides Connection::__construct
File
-
core/
lib/ Drupal/ Core/ Database/ Driver/ pgsql/ Connection.php, line 77
Class
- Connection
- PostgreSQL implementation of \Drupal\Core\Database\Connection.
Namespace
Drupal\Core\Database\Driver\pgsqlCode
public function __construct(\PDO $connection, array $connection_options) {
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;
// Transactional DDL is always available in PostgreSQL,
// but we'll only enable it if standard transactions are.
$this->transactionalDDLSupport = $this->transactionSupport;
$this->connectionOptions = $connection_options;
// Force PostgreSQL to use the UTF-8 character set by default.
$this->connection
->exec("SET NAMES 'UTF8'");
// Execute PostgreSQL init_commands.
if (isset($connection_options['init_commands'])) {
$this->connection
->exec(implode('; ', $connection_options['init_commands']));
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.