1 database.inc db_set_active($key = 'default')

Sets a new active database.

Parameters

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

Return value

string|null: The previous database connection key if the connection changed. NULL if the connection was not changed.

Related topics

File

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

Code

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