db_set_active

  1. drupal
    1. 5 database.inc
    2. 6 database.inc
    3. 7
    4. 8
Versions
5 – 6 db_set_active($name = 'default')
7 – 8 db_set_active($key = 'default')

Sets a new active database.

Parameters

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

Return value

The key of the formerly active database.

Related topics

▾ 2 functions call db_set_active()

DatabaseLoggingTestCase::testEnableMultiConnectionLogging in modules/simpletest/tests/database_test.test
Test that we can log queries separately on different connections.
DatabaseTasks::connect in includes/install.inc
Check if we can connect to the database.

Code

includes/database/database.inc, line 2520

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