*** database.inc	Thu Jul 12 02:25:47 2007
--- database.inc.fix_setactive	Fri Aug 17 17:02:23 2007
***************
*** 100,106 ****
   */
  function db_set_active($name = 'default') {
    global $db_url, $db_type, $active_db;
!   static $db_conns;
  
    if (!isset($db_conns[$name])) {
      // Initiate a new connection, using the named DB URL specified.
--- 100,106 ----
   */
  function db_set_active($name = 'default') {
    global $db_url, $db_type, $active_db;
!   static $db_conns, $active_name;
  
    if (!isset($db_conns[$name])) {
      // Initiate a new connection, using the named DB URL specified.
***************
*** 128,138 ****
      $db_conns[$name] = db_connect($connect_url);
    }
  
    $previous_db = $active_db;
    // Set the active connection.
    $active_db = $db_conns[$name];
  
!   return array_search($previous_db, $db_conns);
  }
  
  /**
--- 128,140 ----
      $db_conns[$name] = db_connect($connect_url);
    }
  
+   $previous_name = $active_name;
    $previous_db = $active_db;
    // Set the active connection.
+   $active_name = $name;
    $active_db = $db_conns[$name];
  
!   return $previous_name || $active_name;
  }
  
  /**
