On this page
final public static function Database::setActiveConnection
final public static Database::setActiveConnection($key = 'default')
Sets the active connection to the specified key.
Return value
The previous database connection key.
File
- includes/database/database.inc, line 1537
- Core systems for the database layer.
Class
- Database
- Primary front-controller for the database system.
Code
final public static function setActiveConnection($key = 'default') {
if (empty(self::$databaseInfo)) {
self::parseConnectionInfo();
}
if (!empty(self::$databaseInfo[$key])) {
$old_key = self::$activeKey;
self::$activeKey = $key;
return $old_key;
}
}
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/includes!database!database.inc/function/Database::setActiveConnection/7.x