function Connection::attachDatabase

Same name in this branch
  1. 9 core/modules/sqlite/src/Driver/Database/sqlite/Connection.php \Drupal\sqlite\Driver\Database\sqlite\Connection::attachDatabase()
Same name in other branches
  1. 10 core/modules/sqlite/src/Driver/Database/sqlite/Connection.php \Drupal\sqlite\Driver\Database\sqlite\Connection::attachDatabase()
  2. 10 core/lib/Drupal/Core/Database/Connection.php \Drupal\Core\Database\Connection::attachDatabase()
  3. 11.x core/modules/sqlite/src/Driver/Database/sqlite/Connection.php \Drupal\sqlite\Driver\Database\sqlite\Connection::attachDatabase()
  4. 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.

1 method overrides Connection::attachDatabase()
Connection::attachDatabase in core/modules/sqlite/src/Driver/Database/sqlite/Connection.php
Allows the connection to access additional databases.

File

core/lib/Drupal/Core/Database/Connection.php, line 460

Class

Connection
Base Database API class.

Namespace

Drupal\Core\Database

Code

public function attachDatabase(string $database) : void {
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.