From e7ec2230d6da27040911f9385f01d7794328bcce Mon Sep 17 00:00:00 2001
From: Greg Anderson <greg.1.anderson@greenknowe.org>
Date: Wed, 3 Apr 2013 13:39:01 -0700
Subject: Issue #1957020 by Greg Anderson, JSCSJSCS, greg.1.anderson: drush
 sql-sync with --create-db does not work and can overwrite MySQL
 default databases

---
 commands/sql/sync.sql.inc |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/commands/sql/sync.sql.inc b/commands/sql/sync.sql.inc
index 56bcc25..ea19c9d 100644
--- a/commands/sql/sync.sql.inc
+++ b/commands/sql/sync.sql.inc
@@ -394,7 +394,7 @@ function drush_sql_sync($source = NULL, $destination = NULL) {
         $create_db_su = drush_sql_su($target_db_url, $destination_settings);
         $db_su_connect = _drush_sql_connect($create_db_su);
         $pre_import_sql = drush_sql_build_createdb_sql($target_db_url);
-        $pre_import_commands = sprintf('echo "%s" | %s; ', $pre_import_sql, $db_su_connect);
+        $pre_import_commands = sprintf('echo "%s" | %s && ', $pre_import_sql, $db_su_connect);
       }

       // Generate the import command
@@ -435,7 +435,7 @@ function drush_sql_sync($source = NULL, $destination = NULL) {
       }
       $import_exec = _drush_backend_generate_command($destination_settings, $import_exec);

-      drush_op_system($import_exec);
+      drush_shell_exec($import_exec);

       // After the database is imported into the destination, we
       // will check and see if we did not collect sanitization
--
1.7.9.5

