public function Connection::__construct in Drupal 10
Same name in this branch
- 10 core/modules/sqlite/src/Driver/Database/sqlite/Connection.php \Drupal\sqlite\Driver\Database\sqlite\Connection::__construct()
- 10 core/modules/pgsql/src/Driver/Database/pgsql/Connection.php \Drupal\pgsql\Driver\Database\pgsql\Connection::__construct()
- 10 core/modules/mysql/src/Driver/Database/mysql/Connection.php \Drupal\mysql\Driver\Database\mysql\Connection::__construct()
Constructs a connection object.
File
- core/
modules/ pgsql/ src/ Driver/ Database/ pgsql/ Connection.php, line 74
Class
- Connection
- PostgreSQL implementation of \Drupal\Core\Database\Connection.
Namespace
Drupal\pgsql\Driver\Database\pgsqlCode
public function __construct(\PDO $connection, array $connection_options) {
parent::__construct($connection, $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']));
}
}