public function Connection::__construct in Drupal 9
Same name in this branch
- 9 core/lib/Drupal/Core/Database/Connection.php \Drupal\Core\Database\Connection::__construct()
- 9 core/lib/Drupal/Core/Database/Driver/sqlite/Connection.php \Drupal\Core\Database\Driver\sqlite\Connection::__construct()
- 9 core/lib/Drupal/Core/Database/Driver/pgsql/Connection.php \Drupal\Core\Database\Driver\pgsql\Connection::__construct()
- 9 core/lib/Drupal/Core/Database/Driver/mysql/Connection.php \Drupal\Core\Database\Driver\mysql\Connection::__construct()
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Database/Driver/pgsql/Connection.php \Drupal\Core\Database\Driver\pgsql\Connection::__construct()
Constructs a connection object.
Overrides Connection::__construct
File
- core/
lib/ Drupal/ Core/ Database/ Driver/ pgsql/ Connection.php, line 79
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);
// 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']));
}
}