Index: includes/update.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/update.inc,v
retrieving revision 1.61
diff -u -p -r1.61 update.inc
--- includes/update.inc	10 Jul 2010 01:57:32 -0000	1.61
+++ includes/update.inc	10 Jul 2010 10:23:25 -0000
@@ -75,9 +75,10 @@ function update_prepare_d7_bootstrap() {
   // still being used.
   include_once DRUPAL_ROOT . '/includes/install.inc';
   drupal_bootstrap(DRUPAL_BOOTSTRAP_CONFIGURATION);
-  global $databases, $db_url, $update_rewrite_settings;
+  global $databases, $db_url, $db_prefix, $update_rewrite_settings;
+  if (empty($db_prefix)) die('db_prefix is empty :(');
   if (empty($databases) && !empty($db_url)) {
-    $databases = update_parse_db_url($db_url);
+    $databases = update_parse_db_url($db_url, $db_prefix);
     // Record the fact that the settings.php file will need to be rewritten.
     $update_rewrite_settings = TRUE;
     $settings_file = conf_path() . '/settings.php';
@@ -312,9 +313,9 @@ function update_fix_d7_requirements() {
 
   // Rewrite the settings.php file if necessary, see
   // update_prepare_d7_bootstrap().
-  global $update_rewrite_settings, $db_url;
+  global $update_rewrite_settings, $db_url, $db_prefix;
   if (!empty($update_rewrite_settings)) {
-    $databases = update_parse_db_url($db_url);
+    $databases = update_parse_db_url($db_url, $db_prefix);
     $salt = drupal_hash_base64(drupal_random_bytes(55));
     file_put_contents(conf_path() . '/settings.php', "\n" . '$databases = ' . var_export($databases, TRUE) . ";\n\$drupal_hash_salt = '$salt';", FILE_APPEND);
   }
@@ -674,7 +675,7 @@ function update_fix_d7_install_profile()
  * @return
  *   Drupal 7 DBTNG compatible array of database connection information.
  */
-function update_parse_db_url($db_url) {
+function update_parse_db_url($db_url, $db_prefix) {
   $databases = array();
   if (!is_array($db_url)) {
     $db_url = array('default' => $db_url);
@@ -691,6 +692,9 @@ function update_parse_db_url($db_url) {
       'host' => urldecode($url['host']),
       'port' => isset($url['port']) ? urldecode($url['port']) : '',
     );
+    if (isset($db_prefix)) {
+      $databases[$database]['default']['prefix'] = $db_prefix;
+    }
   }
   return $databases;
 }
Index: includes/bootstrap.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/bootstrap.inc,v
retrieving revision 1.408
diff -u -p -r1.408 bootstrap.inc
--- includes/bootstrap.inc	9 Jul 2010 00:15:34 -0000	1.408
+++ includes/bootstrap.inc	10 Jul 2010 10:23:25 -0000
@@ -560,7 +560,7 @@ function drupal_settings_initialize() {
   global $base_url, $base_path, $base_root;
 
   // Export the following settings.php variables to the global namespace
-  global $databases, $cookie_domain, $conf, $installed_profile, $update_free_access, $db_url, $drupal_hash_salt, $is_https, $base_secure_url, $base_insecure_url;
+  global $databases, $cookie_domain, $conf, $installed_profile, $update_free_access, $db_url, $db_prefix, $drupal_hash_salt, $is_https, $base_secure_url, $base_insecure_url;
   $conf = array();
 
   if (file_exists(DRUPAL_ROOT . '/' . conf_path() . '/settings.php')) {
