function Connection::__construct
Constructs a \Drupal\sqlite\Driver\Database\sqlite\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.
Overrides Connection::__construct
File
-
core/
modules/ sqlite/ src/ Driver/ Database/ sqlite/ Connection.php, line 89
Class
- Connection
- SQLite implementation of \Drupal\Core\Database\Connection.
Namespace
Drupal\sqlite\Driver\Database\sqliteCode
public function __construct(\PDO $connection, array $connection_options) {
parent::__construct($connection, $connection_options);
// Empty prefix means query the main database -- no need to attach anything.
$prefix = $this->connectionOptions['prefix'] ?? '';
if ($prefix !== '') {
$this->attachDatabase($prefix);
// Add a ., so queries become prefix.table, which is proper syntax for
// querying an attached database.
$prefix .= '.';
}
// Regenerate the prefix.
$this->setPrefix($prefix);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.