From 19331b9c326f11943cb54c61bcea0c3e800a646e Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Sun, 30 Aug 2009 12:43:07 +0000 Subject: [PATCH] bug #2839548 [export] Triggers order on export --- ChangeLog | 1 + export.php | 21 +++++++++++++++++++++ libraries/export/sql.php | 5 ++++- 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index f0f736bcde..6136f036ea 100644 --- a/ChangeLog +++ b/ChangeLog @@ -14,6 +14,7 @@ $HeadURL: https://phpmyadmin.svn.sourceforge.net/svnroot/phpmyadmin/trunk/phpMyA - bug [export] Exporting results of a query which contains a LIMIT clause inside a subquery - bug #2837722 [export] Run complex SQL then export does not work +- bug #2839548 [export] Triggers order on export 3.2.1.0 (2009-08-09) - bug #2799009 Login with ipv6 IP address breaks redirect diff --git a/export.php b/export.php index 5547e4527b..c820135b1e 100644 --- a/export.php +++ b/export.php @@ -444,6 +444,13 @@ if ($export_type == 'server') { break 3; } } + // now export the triggers (needs to be done after the data because + // triggers can modify already imported tables) + if (isset($GLOBALS[$what . '_structure'])) { + if (!PMA_exportStructure($current_db, $table, $crlf, $err_url, $do_relation, $do_comments, $do_mime, $do_dates, 'triggers', $export_type)) { + break 2; + } + } } foreach($views as $view) { // no data export for a view @@ -485,6 +492,13 @@ if ($export_type == 'server') { break 2; } } + // now export the triggers (needs to be done after the data because + // triggers can modify already imported tables) + if (isset($GLOBALS[$what . '_structure'])) { + if (!PMA_exportStructure($db, $table, $crlf, $err_url, $do_relation, $do_comments, $do_mime, $do_dates, 'triggers', $export_type)) { + break 2; + } + } } foreach ($views as $view) { // no data export for a view @@ -536,6 +550,13 @@ if ($export_type == 'server') { break; } } + // now export the triggers (needs to be done after the data because + // triggers can modify already imported tables) + if (isset($GLOBALS[$what . '_structure'])) { + if (!PMA_exportStructure($db, $table, $crlf, $err_url, $do_relation, $do_comments, $do_mime, $do_dates, 'triggers', $export_type)) { + break 2; + } + } if (!PMA_exportDBFooter($db)) { break; } diff --git a/libraries/export/sql.php b/libraries/export/sql.php index a0bedf75f3..5e9c20bf54 100644 --- a/libraries/export/sql.php +++ b/libraries/export/sql.php @@ -763,6 +763,10 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $relation = FALSE, $dump .= PMA_exportComment($GLOBALS['strTableStructure'] . ' ' . $formatted_table_name) . PMA_exportComment(); $dump .= PMA_getTableDef($db, $table, $crlf, $error_url, $dates); + $dump .= PMA_getTableComments($db, $table, $crlf, $relation, $mime); + break; + case 'triggers': + $dump = ''; $triggers = PMA_DBI_get_triggers($db, $table); if ($triggers) { $dump .= PMA_possibleCRLF() @@ -794,7 +798,6 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $relation = FALSE, $dump .= PMA_getTableDefStandIn($db, $table, $crlf); } // end switch - $dump .= PMA_getTableComments($db, $table, $crlf, $relation, $mime); // this one is built by PMA_getTableDef() to use in table copy/move // but not in the case of export unset($GLOBALS['sql_constraints_query']); -- 2.11.4.GIT