From c00cf34886acdea83d104a0a46d140027c0eeadc Mon Sep 17 00:00:00 2001 From: Deven Bansod Date: Fri, 14 Oct 2016 09:54:50 +0530 Subject: [PATCH 1/3] Use IF EXISTS with DROP Database while exporting to prevent error while importing this dump Fix #12634 Signed-off-by: Deven Bansod --- libraries/plugins/export/ExportSql.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/plugins/export/ExportSql.php b/libraries/plugins/export/ExportSql.php index 644e618077..6af3b8b08d 100644 --- a/libraries/plugins/export/ExportSql.php +++ b/libraries/plugins/export/ExportSql.php @@ -236,7 +236,7 @@ class ExportSql extends ExportPlugin if ($plugin_param['export_type'] == 'server') { $leaf = new BoolPropertyItem( "drop_database", - sprintf(__('Add %s statement'), 'DROP DATABASE') + sprintf(__('Add %s statement'), 'DROP DATABASE IF EXISTS') ); $subgroup->addProperty($leaf); } @@ -796,7 +796,7 @@ class ExportSql extends ExportPlugin } if (isset($GLOBALS['sql_drop_database'])) { if (!PMA_exportOutputHandler( - 'DROP DATABASE ' + 'DROP DATABASE IF EXISTS ' . Util::backquoteCompat( $db_alias, $compat, From 201ba095ce39e4a8fbd9bf99968eaca15f195eed Mon Sep 17 00:00:00 2001 From: Deven Bansod Date: Fri, 14 Oct 2016 09:55:50 +0530 Subject: [PATCH 2/3] Adjust tests Signed-off-by: Deven Bansod --- test/classes/plugin/export/ExportSqlTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/classes/plugin/export/ExportSqlTest.php b/test/classes/plugin/export/ExportSqlTest.php index c690da6b4a..8228bb9916 100644 --- a/test/classes/plugin/export/ExportSqlTest.php +++ b/test/classes/plugin/export/ExportSqlTest.php @@ -592,7 +592,7 @@ class ExportSqlTest extends PMATestCase $result = ob_get_clean(); $this->assertContains( - "DROP DATABASE `db`;\n", + "DROP DATABASE IF EXISTS `db`;\n", $result ); @@ -630,7 +630,7 @@ class ExportSqlTest extends PMATestCase $result = ob_get_clean(); $this->assertContains( - "DROP DATABASE db;\n", + "DROP DATABASE IF EXISTS db;\n", $result ); From 34637a71d8618c7af0cba8c63ddaa3a8ee15d872 Mon Sep 17 00:00:00 2001 From: Deven Bansod Date: Fri, 14 Oct 2016 09:58:26 +0530 Subject: [PATCH 3/3] ChangeLog for #12634 Signed-off-by: Deven Bansod --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index 1ef8a5ef83..eaa5d3b5a7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -61,6 +61,7 @@ phpMyAdmin - ChangeLog - issue #12362 prefs_manage.php can leave an orphaned temporary file - issue #12619 Unable to export csv when using union select - issue #12625 Broken Edit links in query results of JOIN query +- issue #12634 Drop DB error in import if DB doesn't exist 4.6.4 (2016-08-16) - issue [security] Weaknesses with cookie encryption, see PMASA-2016-29