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 \Drupal\sqlite\Driver\Database\sqlite\Connection object.
File
- core/
modules/ sqlite/ src/ Driver/ Database/ sqlite/ Connection.php, line 79
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);
}