Merge branch 'QA_3_3'
This commit is contained in:
@@ -370,9 +370,60 @@ function PMA_exportDBCreate($db)
|
||||
return FALSE;
|
||||
}
|
||||
if (isset($GLOBALS['sql_backquotes']) && isset($GLOBALS['sql_compatibility']) && $GLOBALS['sql_compatibility'] == 'NONE') {
|
||||
return PMA_exportOutputHandler('USE ' . PMA_backquote($db) . ';' . $crlf);
|
||||
$result = PMA_exportOutputHandler('USE ' . PMA_backquote($db) . ';' . $crlf);
|
||||
} else {
|
||||
$result = PMA_exportOutputHandler('USE ' . $db . ';' . $crlf);
|
||||
}
|
||||
return PMA_exportOutputHandler('USE ' . $db . ';' . $crlf);
|
||||
|
||||
if ($result && isset($GLOBALS['sql_structure']) && isset($GLOBALS['sql_procedure_function'])) {
|
||||
$text = '';
|
||||
$delimiter = '$$';
|
||||
|
||||
$procedure_names = PMA_DBI_get_procedures_or_functions($db, 'PROCEDURE');
|
||||
$function_names = PMA_DBI_get_procedures_or_functions($db, 'FUNCTION');
|
||||
|
||||
if ($procedure_names || $function_names) {
|
||||
$text .= $crlf
|
||||
. 'DELIMITER ' . $delimiter . $crlf;
|
||||
}
|
||||
|
||||
if ($procedure_names) {
|
||||
$text .=
|
||||
PMA_exportComment()
|
||||
. PMA_exportComment(__('Procedures'))
|
||||
. PMA_exportComment();
|
||||
|
||||
foreach($procedure_names as $procedure_name) {
|
||||
if (! empty($GLOBALS['sql_drop_table'])) {
|
||||
$text .= 'DROP PROCEDURE IF EXISTS ' . PMA_backquote($procedure_name) . $delimiter . $crlf;
|
||||
}
|
||||
$text .= PMA_DBI_get_definition($db, 'PROCEDURE', $procedure_name) . $delimiter . $crlf . $crlf;
|
||||
}
|
||||
}
|
||||
|
||||
if ($function_names) {
|
||||
$text .=
|
||||
PMA_exportComment()
|
||||
. PMA_exportComment(__('Functions'))
|
||||
. PMA_exportComment();
|
||||
|
||||
foreach($function_names as $function_name) {
|
||||
if (! empty($GLOBALS['sql_drop_table'])) {
|
||||
$text .= 'DROP FUNCTION IF EXISTS ' . PMA_backquote($function_name) . $delimiter . $crlf;
|
||||
}
|
||||
$text .= PMA_DBI_get_definition($db, 'FUNCTION', $function_name) . $delimiter . $crlf . $crlf;
|
||||
}
|
||||
}
|
||||
|
||||
if ($procedure_names || $function_names) {
|
||||
$text .= 'DELIMITER ;' . $crlf;
|
||||
}
|
||||
|
||||
if (! empty($text)) {
|
||||
$result = PMA_exportOutputHandler($text);
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -415,49 +466,16 @@ function PMA_exportDBFooter($db)
|
||||
$text = '';
|
||||
$delimiter = '$$';
|
||||
|
||||
$procedure_names = PMA_DBI_get_procedures_or_functions($db, 'PROCEDURE');
|
||||
$function_names = PMA_DBI_get_procedures_or_functions($db, 'FUNCTION');
|
||||
|
||||
if (PMA_MYSQL_INT_VERSION > 50100) {
|
||||
$event_names = PMA_DBI_fetch_result('SELECT EVENT_NAME FROM information_schema.EVENTS WHERE EVENT_SCHEMA= \'' . PMA_sqlAddslashes($db,true) . '\';');
|
||||
} else {
|
||||
$event_names = array();
|
||||
}
|
||||
|
||||
if ($procedure_names || $function_names || $event_names) {
|
||||
if ($event_names) {
|
||||
$text .= $crlf
|
||||
. 'DELIMITER ' . $delimiter . $crlf;
|
||||
}
|
||||
|
||||
if ($procedure_names) {
|
||||
$text .=
|
||||
PMA_exportComment()
|
||||
. PMA_exportComment(__('Procedures'))
|
||||
. PMA_exportComment();
|
||||
|
||||
foreach($procedure_names as $procedure_name) {
|
||||
if (! empty($GLOBALS['sql_drop_table'])) {
|
||||
$text .= 'DROP PROCEDURE IF EXISTS ' . PMA_backquote($procedure_name) . $delimiter . $crlf;
|
||||
}
|
||||
$text .= PMA_DBI_get_definition($db, 'PROCEDURE', $procedure_name) . $delimiter . $crlf . $crlf;
|
||||
}
|
||||
}
|
||||
|
||||
if ($function_names) {
|
||||
$text .=
|
||||
PMA_exportComment()
|
||||
. PMA_exportComment(__('Functions'))
|
||||
. PMA_exportComment();
|
||||
|
||||
foreach($function_names as $function_name) {
|
||||
if (! empty($GLOBALS['sql_drop_table'])) {
|
||||
$text .= 'DROP FUNCTION IF EXISTS ' . PMA_backquote($function_name) . $delimiter . $crlf;
|
||||
}
|
||||
$text .= PMA_DBI_get_definition($db, 'FUNCTION', $function_name) . $delimiter . $crlf . $crlf;
|
||||
}
|
||||
}
|
||||
|
||||
if ($event_names) {
|
||||
$text .=
|
||||
PMA_exportComment()
|
||||
. PMA_exportComment(__('Events'))
|
||||
@@ -469,8 +487,7 @@ function PMA_exportDBFooter($db)
|
||||
}
|
||||
$text .= PMA_DBI_get_definition($db, 'EVENT', $event_name) . $delimiter . $crlf . $crlf;
|
||||
}
|
||||
}
|
||||
if ($procedure_names || $function_names || $event_names) {
|
||||
|
||||
$text .= 'DELIMITER ;' . $crlf;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user