? schema-external2.patch
? schema-support-external-dbs-411538-3.patch
Index: engines/schema_mysql.inc
===================================================================
RCS file: /cvs/drupal/contributions/modules/schema/engines/schema_mysql.inc,v
retrieving revision 1.17
diff -u -p -r1.17 schema_mysql.inc
--- engines/schema_mysql.inc	8 May 2008 03:16:58 -0000	1.17
+++ engines/schema_mysql.inc	4 Apr 2009 21:45:48 -0000
@@ -86,8 +86,16 @@ function schema_mysql_create_table_sql($
 function schema_mysql_inspect($name = NULL) {
   global $db_url;
 
+  // Switch to the active database connection.
+  // The only way to get the active connection's name is to switch to the
+  // default connection and check db_set_active()'s return value. Then, we must
+  // switch back to the original connection that we actually want in order to
+  // proceed.
+  $active_db_connection = db_set_active('default');
+  db_set_active($active_db_connection);
+
   $tables = array();
-  $url = parse_url(is_array($db_url) ? $db_url['default'] : $db_url);
+  $url = parse_url(is_array($db_url) ? $db_url[$active_db_connection] : $db_url);
   $database = substr($url['path'], 1);
 
   $sql = ('SELECT * FROM information_schema.COLUMNS '.
@@ -166,4 +174,4 @@ function schema_mysql_inspect($name = NU
   return $tables;
 }
 
-?>
\ No newline at end of file
+?>
Index: engines/schema_pgsql.inc
===================================================================
RCS file: /cvs/drupal/contributions/modules/schema/engines/schema_pgsql.inc,v
retrieving revision 1.18
diff -u -p -r1.18 schema_pgsql.inc
--- engines/schema_pgsql.inc	28 Oct 2008 20:44:48 -0000	1.18
+++ engines/schema_pgsql.inc	4 Apr 2009 21:45:48 -0000
@@ -21,8 +21,16 @@ function schema_pgsql_schema_type_map() 
 function schema_pgsql_inspect($tbl_name = NULL) {
   global $db_url;
 
+  // Switch to the active database connection.
+  // The only way to get the active connection's name is to switch to the
+  // default connection and check db_set_active()'s return value. Then, we must
+  // switch back to the original connection that we actually want in order to
+  // proceed.
+  $active_db_connection = db_set_active('default');
+  db_set_active($active_db_connection);
+
   $tables = array();
-  $url = parse_url(is_array($db_url) ? $db_url['default'] : $db_url);
+  $url = parse_url(is_array($db_url) ? $db_url[$active_db_connection] : $db_url);
   $database = substr($url['path'], 1);
 
   //
@@ -200,4 +208,4 @@ function schema_pgsql_inspect($tbl_name 
   return $tables;
 }
 
-?>
\ No newline at end of file
+?>
