function Connection::__construct
Constructs a connection object.
Parameters
object $connection: An object of the client 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
-
core/
modules/ pgsql/ src/ Driver/ Database/ pgsql/ Connection.php, line 79
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']));
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.