The branch, export_xml has been updated
via d0caeef254b67b70ed1243f1edeaa2c0f46418ce (commit)
from d03cf63a9fd29b12943b10520b860ca6eb13d2a5 (commit)
- Log -----------------------------------------------------------------
commit d0caeef254b67b70ed1243f1edeaa2c0f46418ce
Author: Aamir Khan <systemw0rm(a)users.sourceforge.net>
Date: Tue Dec 21 16:48:44 2010 +0100
bug #3136658, xml export : functions/routines should be exported before tables/views
-----------------------------------------------------------------------
Summary of changes:
libraries/export/xml.php | 98 ++++++++++++++++++++++++---------------------
1 files changed, 52 insertions(+), 46 deletions(-)
diff --git a/libraries/export/xml.php b/libraries/export/xml.php
index 073bb7d..58e3876 100644
--- a/libraries/export/xml.php
+++ b/libraries/export/xml.php
@@ -126,7 +126,59 @@ function PMA_exportHeader() {
$head .= ' -->' . $crlf;
$head .= ' <pma:structure_schemas>' . $crlf;
$head .= ' <pma:database name="' . $db . '"
collation="' . $db_collation . '" charset="' . $db_charset .
'">' . $crlf;
+
+ /***** Exporting functions first *****/
+
+ if (isset($GLOBALS[$what . '_export_functions']) &&
$GLOBALS[$what . '_export_functions']) {
+ // Export functions
+ $functions = PMA_DBI_get_procedures_or_functions($db, 'FUNCTION');
+ if ($functions) {
+ foreach ($functions as $function) {
+ $head .= ' <pma:function name="' .
$function . '">' . $crlf;
+
+ // Do some formatting
+ $sql = PMA_DBI_get_definition($db, 'FUNCTION', $function);
+ $sql = rtrim($sql);
+ $sql = " " . $sql;
+ $sql = str_replace("\n", "\n ",
$sql);
+
+ $head .= $sql . $crlf;
+ $head .= ' </pma:function>' . $crlf;
+ }
+
+ unset($create_func);
+ unset($function);
+ unset($functions);
+ }
+ }
+
+ /****** Exporting Procedures second ******/
+
+ if (isset($GLOBALS[$what . '_export_procedures']) && $GLOBALS[$what .
'_export_procedures']) {
+ // Export procedures
+ $procedures = PMA_DBI_get_procedures_or_functions($db, 'PROCEDURE');
+ if ($procedures) {
+ foreach ($procedures as $procedure) {
+ $head .= ' <pma:procedure name="' .
$procedure . '">' . $crlf;
+
+ // Do some formatting
+ $sql = PMA_DBI_get_definition($db, 'PROCEDURE', $procedure);
+ $sql = rtrim($sql);
+ $sql = " " . $sql;
+ $sql = str_replace("\n", "\n ",
$sql);
+
+ $head .= $sql . $crlf;
+ $head .= ' </pma:procedure>' . $crlf;
+ }
+
+ unset($create_proc);
+ unset($procedure);
+ unset($procedures);
+ }
+ }
+ /****** Exporting Tables & views structure ******/
+
if (count($tables) == 0) {
$tables[] = $table;
}
@@ -183,52 +235,6 @@ function PMA_exportHeader() {
}
}
- if (isset($GLOBALS[$what . '_export_functions']) &&
$GLOBALS[$what . '_export_functions']) {
- // Export functions
- $functions = PMA_DBI_get_procedures_or_functions($db, 'FUNCTION');
- if ($functions) {
- foreach ($functions as $function) {
- $head .= ' <pma:function name="' .
$function . '">' . $crlf;
-
- // Do some formatting
- $sql = PMA_DBI_get_definition($db, 'FUNCTION', $function);
- $sql = rtrim($sql);
- $sql = " " . $sql;
- $sql = str_replace("\n", "\n ",
$sql);
-
- $head .= $sql . $crlf;
- $head .= ' </pma:function>' . $crlf;
- }
-
- unset($create_func);
- unset($function);
- unset($functions);
- }
- }
-
- if (isset($GLOBALS[$what . '_export_procedures']) &&
$GLOBALS[$what . '_export_procedures']) {
- // Export procedures
- $procedures = PMA_DBI_get_procedures_or_functions($db, 'PROCEDURE');
- if ($procedures) {
- foreach ($procedures as $procedure) {
- $head .= ' <pma:procedure name="' .
$procedure . '">' . $crlf;
-
- // Do some formatting
- $sql = PMA_DBI_get_definition($db, 'PROCEDURE', $procedure);
- $sql = rtrim($sql);
- $sql = " " . $sql;
- $sql = str_replace("\n", "\n ",
$sql);
-
- $head .= $sql . $crlf;
- $head .= ' </pma:procedure>' . $crlf;
- }
-
- unset($create_proc);
- unset($procedure);
- unset($procedures);
- }
- }
-
unset($result);
$head .= ' </pma:database>' . $crlf;
hooks/post-receive
--
phpMyAdmin