? 925776-3530550.patch
? includes/table.inc
Index: commands/core/site_install.drush.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/drush/commands/core/site_install.drush.inc,v
retrieving revision 1.8
diff -r1.8 site_install.drush.inc
65c65,66
<   // TODO: support db-su like sql sync.
---
>   // @TODO: support db-su like sql sync.
> 
67,77c68,93
<   $exec = 'mysql ' . _drush_sql_get_credentials($db_spec);
<   // Strip DB name from credentials. Soon it won't exist anymore. We do
<   // need a DB name to connect to so use built-in mysql DB.
<   $replacement_db = 'information_schema';
<   // Make sure we are only replacing the database name,
<   // and not a username or password that is the same as the database name.
<   $exec = str_replace(" {$db_spec['database']}", " {$replacement_db}", $exec) . ' -e ';
<   // Quote database name with backticks, and add escaping for the shell.
<   $database_name = "\`{$db_spec['database']}\`";
<   if (drush_op('system', $exec . ' "DROP DATABASE IF EXISTS ' . $database_name . '"') && !drush_get_context('DRUSH_SIMULATE')) {
<     drush_set_error(dt('Could not drop database: @name', array('@name' => $db_spec['database'])));
---
>   // Get credentials to connect to the server, but not the database which we
>   // are about to DROP.
> 
>   // Save the database name before we unset() it.
>   $db_name = $db_spec['database'];
>   $scheme = _drush_sql_get_scheme($db_spec);
> 
>   // _drush_sql_get_credentials() will set a default database according to
>   // the scheme if one is not set.
>   unset($db_spec['database']);
>   $credentials = _drush_sql_get_credentials($db_spec);
> 
>   switch ($scheme) {
>     case 'mysql':
>       $command_parameter_name = 'execute';
>       break;
>     case 'pgsql':
>       $command_parameter_name = 'command';
>       break;
>   }
>   $execute = "$scheme $credentials --$command_parameter_name";
> 
>   $simulate = drush_get_context('DRUSH_SIMULATE');
> 
>   if (drush_op('system', "$execute='DROP DATABASE IF EXISTS \`$db_name\`'") && !$simulate) {
>     drush_set_error(dt('Could not drop database: @name', array('@name' => $db_name)));
81,82c97,98
<   if (drush_op('system', $exec . '"CREATE DATABASE ' . $database_name . '"') && !drush_get_context('DRUSH_SIMULATE')) {
<     drush_set_error(dt('Could not create new database: @name', array('@name' => $db_spec['database'])));
---
>   if (drush_op('system', "$execute='CREATE DATABASE \`$db_name\`'") && !$simulate) {
>     drush_set_error(dt('Could not create new database: @name', array('@name' => $db_name)));
Index: commands/sql/sql.drush.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/drush/commands/sql/sql.drush.inc,v
retrieving revision 1.52
diff -r1.52 sql.drush.inc
245c245,246
<       $extra = ' --single-transaction --opt -Q' . _drush_sql_get_credentials($db_spec);
---
>       // mysqldump wants 'databases ' instead of 'database=' for no good reason.
>       $extra = ' --single-transaction --opt -Q' . str_replace('--database=', '--databases ', _drush_sql_get_credentials($db_spec));
538a540,542
>   // Build an array of key-value pairs for the parameters.
>   $parameters = array();
> 
541,544c545,563
<       $cred = ' -h' . $db_spec['host'] .
<          (empty($db_spec['port']) ? '' : ' -P' . $db_spec['port']) .
<          ' -u' . $db_spec['username'] .
<          (empty($db_spec['password']) ? '' : ' -p' . $db_spec['password']) . ' ' . $db_spec['database'];
---
>       // Some drush commands (e.g. site-install) want to connect to the
>       // server, but not the database.  Connect to the built-in database.
>       $parameters['database'] = empty($db_spec['database']) ? 'information_schema' : $db_spec['database'];
> 
>       // Host is required.
>       $parameters['host'] = $db_spec['host'];
> 
>       // An empty port is invalid.
>       if (!empty($db_spec['port'])) {
>         $parameters['port'] = $db_spec['port'];
>       }
> 
>       // User is required. Drupal calls it 'username'. MySQL calls it 'user'.
>       $parameters['user'] = $db_spec['username'];
> 
>       // EMPTY password is not the same as NO password, and is valid.
>       if (isset($db_spec['password'])) {
>         $parameters['password'] = $db_spec['password'];
>       }
546,555c565,580
<   case 'pgsql':
<       $cred = (isset($db_spec['database']) ? ' -d ' . (empty($db_spec['database']) ? 'template1' :  $db_spec['database']) : '') .
<          (empty($db_spec['host'])  ? ' -h localhost ' : ' -h ' . $db_spec['host']) .
<          (empty($db_spec['port']) ? ' -p 5432 ' : ' -p ' . $db_spec['port']);
<       // Adding '-U' will cause Postgres to prompt for a password, so disable this for now.
<       // Use "sudo -u postgres drush sql ..." to access the database without a password,
<       // presuming that "postgres" is the database superuser and you have
<       // "local all all ident sameuser" in your Postgres pg_hba.conf file.
<       // See: http://drupal.org/node/438828
<       $cred .= ' -U ' . $db_spec['username'] . ' ';
---
> 
>     case 'pgsql':
>       // Database is optional in Postgres.
>       if (isset($db_spec['database'])) {
>         $parameters['dbname'] = empty($db_spec['database']) ? 'template1' : $db_spec['database'];
>       }
> 
>       // Host and port are optional but have defaults.
>       $parameters['host'] = empty($db_spec['host']) ? 'localhost' : $db_spec['host'];
>       $parameters['port'] = empty($db_spec['port']) ? '5432' : $db_spec['port'];
> 
>       // Username is required.
>       $parameters['username'] = $db_spec['username'];
> 
>       // Don't set the password.
>       // @see http://drupal.org/node/438828
558c583,593
<   return escapeshellcmd($cred);
---
> 
>   // Turn each parameter into a valid parameter string.
>   $parameter_strings = array();
>   foreach ($parameters as $key => $value) {
>     // Only escape the values, not the keys or the rest of the string.
>     $value = escapeshellcmd($value);
>     $parameter_strings[] = "--$key='$value'";
>   }
> 
>   // Join the parameters and return.
>   return ' ' . implode(' ', $parameter_strings);
