The branch, QA_3_4 has been updated via 6e0a10494f6670b3e67d6fb219a96c8001dcea2c (commit) from 5f78897bc8eadf5b399b9b4118bdb575f9f3e0a3 (commit)
- Log ----------------------------------------------------------------- commit 6e0a10494f6670b3e67d6fb219a96c8001dcea2c Author: Madhura Jayaratne madhura.cj@gmail.com Date: Wed Dec 7 08:33:28 2011 +0530
bug #3452506 [edit] Unable to move tables with triggers
-----------------------------------------------------------------------
Summary of changes: ChangeLog | 1 + libraries/Table.class.php | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/ChangeLog b/ChangeLog index 70621d8..0c3ce00 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,6 +8,7 @@ phpMyAdmin - ChangeLog - bug #3398788 [session] No feedback when result is empty (signon auth_type) - bug #3384035 [display] Problems regarding ShowTooltipAliasTB - bug #3306875 [edit] Can't rename a database that contains views +- bug #3452506 [edit] Unable to move tables with triggers
3.4.8.0 (2011-12-01) - bug #3425230 [interface] enum data split at space char (more space to edit) diff --git a/libraries/Table.class.php b/libraries/Table.class.php index d7af2d7..5cb46fa 100644 --- a/libraries/Table.class.php +++ b/libraries/Table.class.php @@ -1033,6 +1033,17 @@ class PMA_Table return false; }
+ // If the table is moved to a different database drop its triggers first + $triggers = PMA_DBI_get_triggers($this->getDbName(), $this->getName(), ''); + $handle_triggers = $this->getDbName() != $new_db && $triggers; + if ($handle_triggers) { + foreach ($triggers as $trigger) { + $sql = 'DROP TRIGGER IF EXISTS ' . PMA_backquote($this->getDbName()) . '.' + . PMA_backquote($trigger['name']) . ';'; + PMA_DBI_query($sql); + } + } + /* * tested also for a view, in MySQL 5.0.92, 5.1.55 and 5.5.13 */ @@ -1041,6 +1052,13 @@ class PMA_Table TO ' . $new_table->getFullName(true) . ';'; // I don't think a specific error message for views is necessary if (! PMA_DBI_query($GLOBALS['sql_query'])) { + // Restore triggers in the old database + if ($handle_triggers) { + PMA_DBI_select_db($this->getDbName()); + foreach ($triggers as $trigger) { + PMA_DBI_query($trigger['create']); + } + } $this->errors[] = sprintf(__('Error renaming table %1$s to %2$s'), $this->getFullName(), $new_table->getFullName()); return false; }
hooks/post-receive