From 565dc8d348d861541983d8b9d38d407d891e2b12 Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Sun, 6 Apr 2008 23:22:19 +0000 Subject: [PATCH] bug #1906983 [export] Reimport of FUNCTION fails --- ChangeLog | 1 + libraries/export/sql.php | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 66dffbf9f..49cb6f0ec 100644 --- a/ChangeLog +++ b/ChangeLog @@ -74,6 +74,7 @@ danbarry - patch #1895796 [lang] Typo in Japanese lang files, thanks to tyman - acoustype - bug #1935652 [auth] Access denied (show warning about mcrypt on login page) +- bug #1906983 [export] Reimport of FUNCTION fails 2.11.5.1 (2008-03-29) - bug #1909711 [security] Sensitive data in session files diff --git a/libraries/export/sql.php b/libraries/export/sql.php index 1a66178a4..5441549f7 100644 --- a/libraries/export/sql.php +++ b/libraries/export/sql.php @@ -60,7 +60,10 @@ if (isset($plugin_list)) { $drop_clause = 'DROP TABLE'; } } else { - $drop_clause = 'DROP TABLE / DROP VIEW'; + $drop_clause = 'DROP TABLE / VIEW / PROCEDURE / FUNCTION'; + if (PMA_MYSQL_INT_VERSION > 50100) { + $drop_clause .= ' / EVENT'; + } } $plugin_list['sql']['options'][] = array('type' => 'bool', 'name' => 'drop_table', 'text' => sprintf($GLOBALS['strAddClause'], $drop_clause)); @@ -340,6 +343,9 @@ function PMA_exportDBFooter($db) . PMA_exportComment(); foreach($procedure_names as $procedure_name) { + if (! empty($GLOBALS['sql_drop_table'])) { + $text .= 'DROP PROCEDURE ' . PMA_backquote($procedure_name) . $delimiter . $crlf; + } $text .= PMA_DBI_get_definition($db, 'PROCEDURE', $procedure_name) . $delimiter . $crlf . $crlf; } } @@ -351,6 +357,9 @@ function PMA_exportDBFooter($db) . PMA_exportComment(); foreach($function_names as $function_name) { + if (! empty($GLOBALS['sql_drop_table'])) { + $text .= 'DROP FUNCTION ' . PMA_backquote($function_name) . $delimiter . $crlf; + } $text .= PMA_DBI_get_definition($db, 'FUNCTION', $function_name) . $delimiter . $crlf . $crlf; } } @@ -362,6 +371,9 @@ function PMA_exportDBFooter($db) . PMA_exportComment(); foreach($event_names as $event_name) { + if (! empty($GLOBALS['sql_drop_table'])) { + $text .= 'DROP EVENT ' . PMA_backquote($event_name) . $delimiter . $crlf; + } $text .= PMA_DBI_get_definition($db, 'EVENT', $event_name) . $delimiter . $crlf . $crlf; } }