You are here

function db_set_active in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/includes/database.inc \db_set_active()

Sets a new active database.

Parameters

$key: The key in the $databases array to set as the default database.

Return value

string|null The key of the formerly active database.

Deprecated

as of Drupal 8.0.x, will be removed in Drupal 9.0.0. Use \Drupal\Core\Database\Database::setActiveConnection().

Related topics

5 calls to db_set_active()
LoggingTest::testEnableMultiConnectionLogging in core/modules/system/src/Tests/Database/LoggingTest.php
Tests that we can log queries separately on different connections.
Tasks::connect in core/lib/Drupal/Core/Database/Install/Tasks.php
Check if we can connect to the database.
Tasks::connect in core/lib/Drupal/Core/Database/Driver/sqlite/Install/Tasks.php
Check if we can connect to the database.
Tasks::connect in core/lib/Drupal/Core/Database/Driver/pgsql/Install/Tasks.php
Check if we can connect to the database.
Tasks::connect in core/lib/Drupal/Core/Database/Driver/mysql/Install/Tasks.php
Check if we can connect to the database.

File

core/includes/database.inc, line 332
Core systems for the database layer.

Code

function db_set_active($key = 'default') {
  return Database::setActiveConnection($key);
}