diff options
Diffstat (limited to 'includes/database.inc')
-rw-r--r-- | includes/database.inc | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/includes/database.inc b/includes/database.inc index 5d58feff9..d2992dc8b 100644 --- a/includes/database.inc +++ b/includes/database.inc @@ -95,6 +95,8 @@ function db_prefix_tables($sql) { * @param $name * The name assigned to the newly active database connection. If omitted, the * default connection will be made active. + * + * @return the name of the */ function db_set_active($name = 'default') { global $db_url, $db_type, $active_db; @@ -110,7 +112,7 @@ function db_set_active($name = 'default') { } $db_type = substr($connect_url, 0, strpos($connect_url, '://')); - $handler = "./includes/database.$db_type.inc"; + $handler = "./includes/database.$db_type.inc"; if (is_file($handler)) { include_once $handler; @@ -124,10 +126,13 @@ function db_set_active($name = 'default') { } $db_conns[$name] = db_connect($connect_url); - } + + $previous_db = $active_db; // Set the active connection. $active_db = $db_conns[$name]; + + return array_search($previousdb, $db_conns); } /** |