Error message
You are browsing documentation for drupal 7.x, which is not supported anymore. Read the updated version of this page for drupal 11.x (the latest version).function db_set_active
Same name and namespace in other branches
- 8.9.x 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
The key of the formerly active database.
Related topics
- Database abstraction layer
- Allow the use of different database servers using the same code base.
2 calls to 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.
File
-
includes/
database/ database.inc, line 2671
Code
function db_set_active ($key = 'default') {
return Database ::setActiveConnection ($key);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.