function Connection::attachDatabase
Same name in this branch
- 10 core/modules/sqlite/src/Driver/Database/sqlite/Connection.php \Drupal\sqlite\Driver\Database\sqlite\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()
- 11.x core/modules/sqlite/src/Driver/Database/sqlite/Connection.php \Drupal\sqlite\Driver\Database\sqlite\Connection::attachDatabase()
- 11.x core/lib/Drupal/Core/Database/Connection.php \Drupal\Core\Database\Connection::attachDatabase()
Allows the connection to access additional databases.
Database systems usually group tables in 'databases' or 'schemas', that can be accessed with syntax like 'SELECT * FROM database.table'. Normally Drupal accesses tables in a single database/schema, but in some cases it may be necessary to access tables from other databases/schemas in the same database server. This method can be called to ensure that the additional database/schema is accessible.
For MySQL, PostgreSQL and most other databases no action need to be taken to query data in another database or schema. For SQLite this is however necessary and the database driver for SQLite will override this method.
@internal
Parameters
string $database: The database to be attached to the connection.
File
-
core/
lib/ Drupal/ Core/ Database/ Connection.php, line 430
Class
- Connection
- Base Database API class.
Namespace
Drupal\Core\DatabaseCode
public function attachDatabase(string $database) : void {
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.