You are here

final public static function Database::setActiveConnection in Drupal 7

Sets the active connection to the specified key.

Return value

The previous database connection key.

2 calls to Database::setActiveConnection()
db_set_active in includes/database/database.inc
Sets a new active database.
SchemaTestCase::testFindTables in modules/simpletest/tests/schema.test
Tests the findTables() method.

File

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

Class

Database
Primary front-controller for the database system.

Code

public static final 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;
  }
}