From aecd316184d76e69dab7d1f143fa955413a843b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20Hojtsy?= Date: Wed, 2 Jan 2008 19:15:34 +0000 Subject: #168315 by schuyler1d: previous active database name was not consistently returned in db_set_active() --- includes/database.inc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'includes') diff --git a/includes/database.inc b/includes/database.inc index a56e39490..45a8b592c 100644 --- a/includes/database.inc +++ b/includes/database.inc @@ -123,7 +123,7 @@ function db_prefix_tables($sql) { */ function db_set_active($name = 'default') { global $db_url, $db_type, $active_db; - static $db_conns; + static $db_conns, $active_name = FALSE; if (empty($db_url)) { include_once 'includes/install.inc'; @@ -152,11 +152,12 @@ function db_set_active($name = 'default') { $db_conns[$name] = db_connect($connect_url); } - $previous_db = $active_db; + $previous_name = $active_name; // Set the active connection. + $active_name = $name; $active_db = $db_conns[$name]; - return array_search($previous_db, $db_conns); + return $previous_name; } /** -- cgit v1.2.3