Merge remote-tracking branch 'origin/QA_4_4' into QA_4_4
This commit is contained in:
commit
375602fc21
@ -662,6 +662,13 @@ function PMA_exportDatabase(
|
||||
if (! $export_plugin->exportDBFooter($db, $db_alias)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (($GLOBALS['sql_structure_or_data'] == 'structure'
|
||||
|| $GLOBALS['sql_structure_or_data'] == 'structure_and_data')
|
||||
&& isset($GLOBALS['sql_procedure_function'])
|
||||
) {
|
||||
$export_plugin->exportEvents($db, $aliases);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -109,6 +109,19 @@ abstract class ExportPlugin
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* Exports events
|
||||
*
|
||||
* @param string $db Database
|
||||
* @param array $aliases Aliases of db/table/columns
|
||||
*
|
||||
* @return bool Whether it succeeded
|
||||
*/
|
||||
public function exportEvents($db, $aliases = array())
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs table's structure
|
||||
*
|
||||
|
||||
@ -887,50 +887,58 @@ class ExportSql extends ExportPlugin
|
||||
unset($GLOBALS['sql_constraints']);
|
||||
}
|
||||
|
||||
if (($GLOBALS['sql_structure_or_data'] == 'structure'
|
||||
|| $GLOBALS['sql_structure_or_data'] == 'structure_and_data')
|
||||
&& isset($GLOBALS['sql_procedure_function'])
|
||||
) {
|
||||
$text = '';
|
||||
$delimiter = '$$';
|
||||
|
||||
$event_names = $GLOBALS['dbi']->fetchResult(
|
||||
'SELECT EVENT_NAME FROM information_schema.EVENTS WHERE'
|
||||
. ' EVENT_SCHEMA= \''
|
||||
. PMA_Util::sqlAddSlashes($db, true)
|
||||
. '\';'
|
||||
);
|
||||
|
||||
if ($event_names) {
|
||||
$text .= $crlf
|
||||
. 'DELIMITER ' . $delimiter . $crlf;
|
||||
|
||||
$text .=
|
||||
$this->_exportComment()
|
||||
. $this->_exportComment(__('Events'))
|
||||
. $this->_exportComment();
|
||||
|
||||
foreach ($event_names as $event_name) {
|
||||
if (! empty($GLOBALS['sql_drop_table'])) {
|
||||
$text .= 'DROP EVENT '
|
||||
. PMA_Util::backquote($event_name)
|
||||
. $delimiter . $crlf;
|
||||
}
|
||||
$text .= $GLOBALS['dbi']
|
||||
->getDefinition($db, 'EVENT', $event_name)
|
||||
. $delimiter . $crlf . $crlf;
|
||||
}
|
||||
|
||||
$text .= 'DELIMITER ;' . $crlf;
|
||||
}
|
||||
|
||||
if (! empty($text)) {
|
||||
$result = PMA_exportOutputHandler($text);
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Exports events
|
||||
*
|
||||
* @param string $db Database
|
||||
* @param array $aliases Aliases of db/table/columns
|
||||
*
|
||||
* @return bool Whether it succeeded
|
||||
*/
|
||||
public function exportEvents($db, $aliases = array())
|
||||
{
|
||||
global $crlf;
|
||||
|
||||
$text = '';
|
||||
$delimiter = '$$';
|
||||
|
||||
$event_names = $GLOBALS['dbi']->fetchResult(
|
||||
"SELECT EVENT_NAME FROM information_schema.EVENTS WHERE"
|
||||
. " EVENT_SCHEMA= '" . PMA_Util::sqlAddSlashes($db, true) . "';"
|
||||
);
|
||||
|
||||
if ($event_names) {
|
||||
$text .= $crlf
|
||||
. "DELIMITER " . $delimiter . $crlf;
|
||||
|
||||
$text .=
|
||||
$this->_exportComment()
|
||||
. $this->_exportComment(__('Events'))
|
||||
. $this->_exportComment();
|
||||
|
||||
foreach ($event_names as $event_name) {
|
||||
if (! empty($GLOBALS['sql_drop_table'])) {
|
||||
$text .= "DROP EVENT "
|
||||
. PMA_Util::backquote($event_name)
|
||||
. $delimiter . $crlf;
|
||||
}
|
||||
$text .= $GLOBALS['dbi']->getDefinition($db, 'EVENT', $event_name)
|
||||
. $delimiter . $crlf . $crlf;
|
||||
}
|
||||
|
||||
$text .= "DELIMITER ;" . $crlf;
|
||||
}
|
||||
|
||||
if (! empty($text)) {
|
||||
return PMA_exportOutputHandler($text);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a stand-in CREATE definition to resolve view dependencies
|
||||
*
|
||||
|
||||
Loading…
Reference in New Issue
Block a user