bug #2852370 [operations] Renaming database deletes triggers

This commit is contained in:
Marc Delisle
2009-09-27 13:23:07 +00:00
parent d3dd6eda32
commit 2227f1c4c3
3 changed files with 18 additions and 2 deletions

View File

@@ -48,6 +48,7 @@ $HeadURL: https://phpmyadmin.svn.sourceforge.net/svnroot/phpmyadmin/trunk/phpMyA
thanks to Thomas Pulickal - jemajoign
- bug #2832600 [export] Slow export when having lots of databases
- bug #2537766 [import] Comments are stripped when editing store procedures
- bug #2852370 [operations] Renaming database deletes triggers
3.2.2.0 (2009-09-13)
- bug #2825293 [structure] Default value for a BIT column

View File

@@ -97,6 +97,11 @@ if (strlen($db) && (! empty($db_rename) || ! empty($db_copy))) {
}
if ($this_what != 'nocopy') {
// keep the triggers from the original db+table
// (third param is empty because delimiters are only intended
// for importing via the mysql client or our Import feature)
$triggers = PMA_DBI_get_triggers($db, $each_table, '');
if (! PMA_Table::moveCopy($db, $each_table, $newname, $each_table,
isset($this_what) ? $this_what : 'data', $move, 'db_copy'))
{
@@ -105,6 +110,16 @@ if (strlen($db) && (! empty($db_rename) || ! empty($db_copy))) {
$sql_query = $back . $sql_query;
break;
}
// apply the triggers to the destination db+table
if ($triggers) {
PMA_DBI_select_db($newname);
foreach ($triggers as $trigger) {
PMA_DBI_query($trigger['create']);
}
unset($trigger);
}
unset($triggers);
if (isset($GLOBALS['add_constraints'])) {
$GLOBALS['sql_constraints_query_full_db'] .= $GLOBALS['sql_constraints_query'];
unset($GLOBALS['sql_constraints_query']);

View File

@@ -1389,10 +1389,11 @@ function PMA_DBI_get_definition($db, $which, $name, $link = null)
* @uses PMA_DBI_fetch_result()
* @param string $db db name
* @param string $table table name
* @param string $delimiter the delimiter to use (may be empty)
*
* @return array information about triggers (may be empty)
*/
function PMA_DBI_get_triggers($db, $table)
function PMA_DBI_get_triggers($db, $table, $delimiter = '//')
{
$result = array();
@@ -1406,7 +1407,6 @@ function PMA_DBI_get_triggers($db, $table)
}
if ($triggers) {
$delimiter = '//';
foreach ($triggers as $trigger) {
if ($GLOBALS['cfg']['Server']['DisableIS']) {
$trigger['TRIGGER_NAME'] = $trigger['Trigger'];