function Connection::attachDatabase
Same name in this branch
- 11.x core/lib/Drupal/Core/Database/Connection.php \Drupal\Core\Database\Connection::attachDatabase()
Same name in other branches
- 9 core/modules/sqlite/src/Driver/Database/sqlite/Connection.php \Drupal\sqlite\Driver\Database\sqlite\Connection::attachDatabase()
- 9 core/lib/Drupal/Core/Database/Connection.php \Drupal\Core\Database\Connection::attachDatabase()
- 10 core/modules/sqlite/src/Driver/Database/sqlite/Connection.php \Drupal\sqlite\Driver\Database\sqlite\Connection::attachDatabase()
- 10 core/lib/Drupal/Core/Database/Connection.php \Drupal\Core\Database\Connection::attachDatabase()
Overrides Connection::attachDatabase
1 call to Connection::attachDatabase()
- Connection::__construct in core/
modules/ sqlite/ src/ Driver/ Database/ sqlite/ Connection.php - Constructs a \Drupal\sqlite\Driver\Database\sqlite\Connection object.
File
-
core/
modules/ sqlite/ src/ Driver/ Database/ sqlite/ Connection.php, line 196
Class
- Connection
- SQLite implementation of \Drupal\Core\Database\Connection.
Namespace
Drupal\sqlite\Driver\Database\sqliteCode
public function attachDatabase(string $database) : void {
// Only attach the database once.
if (!isset($this->attachedDatabases[$database])) {
// In memory database use ':memory:' as database name. According to
// http://www.sqlite.org/inmemorydb.html it will open a unique database so
// attaching it twice is not a problem.
$database_file = $this->connectionOptions['database'] !== ':memory:' ? $this->connectionOptions['database'] . '-' . $database : $this->connectionOptions['database'];
$this->query('ATTACH DATABASE :database_file AS :database', [
':database_file' => $database_file,
':database' => $database,
]);
$this->attachedDatabases[$database] = $database;
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.