1 database.inc final public static Database::setActiveConnection($key = 'default')

Sets the active connection to the specified key.

Return value

string|NULL: The previous database connection key.

File

core/includes/database/database.inc, line 1600
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;
  }
  return NULL;
}