The branch, master has been updated
via 3121006d8f5575150587ba26e326557120cc8190 (commit)
via c4944f560fcb42d0fbd6c8e90895f6020d2daf48 (commit)
via 7ac39c04c26394a8d7daa9ce8715f51dc359a61e (commit)
via 6e0a10494f6670b3e67d6fb219a96c8001dcea2c (commit)
from b9fbeecda46084e5ca271daa7efcee2edebfc50b (commit)
- Log -----------------------------------------------------------------
commit 3121006d8f5575150587ba26e326557120cc8190
Author: Madhura Jayaratne <madhura.cj(a)gmail.com>
Date: Wed Dec 7 12:24:04 2011 +0530
Already contains a semicolon
commit c4944f560fcb42d0fbd6c8e90895f6020d2daf48
Author: Madhura Jayaratne <madhura.cj(a)gmail.com>
Date: Wed Dec 7 08:59:19 2011 +0530
Record trigger creation
commit 7ac39c04c26394a8d7daa9ce8715f51dc359a61e
Merge: b9fbeec 6e0a104
Author: Madhura Jayaratne <madhura.cj(a)gmail.com>
Date: Wed Dec 7 08:53:13 2011 +0530
Merge branch 'QA_3_4'
Conflicts:
libraries/Table.class.php
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 1 +
db_operations.php | 3 ++-
libraries/Table.class.php | 18 ++++++++++++++++++
3 files changed, 21 insertions(+), 1 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index b318d40..b68aeb1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -70,6 +70,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/db_operations.php b/db_operations.php
index b20c2f6..e4c5591 100644
--- a/db_operations.php
+++ b/db_operations.php
@@ -134,7 +134,7 @@ if (strlen($db) && (! empty($db_rename) || ! empty($db_copy)))
{
$sql_view_standin = PMA_getTableDefStandIn($db, $each_table,
"\n");
PMA_DBI_select_db($newname);
PMA_DBI_query($sql_view_standin);
- $GLOBALS['sql_query'] .= "\n" . $sql_view_standin .
';';
+ $GLOBALS['sql_query'] .= "\n" . $sql_view_standin;
}
}
@@ -180,6 +180,7 @@ if (strlen($db) && (! empty($db_rename) || ! empty($db_copy)))
{
PMA_DBI_select_db($newname);
foreach ($triggers as $trigger) {
PMA_DBI_query($trigger['create']);
+ $GLOBALS['sql_query'] .= "\n" .
$trigger['create'] . ';';
}
unset($trigger);
}
diff --git a/libraries/Table.class.php b/libraries/Table.class.php
index 0f91593..16ccfc3 100644
--- a/libraries/Table.class.php
+++ b/libraries/Table.class.php
@@ -1131,6 +1131,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
*/
@@ -1139,6 +1150,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(),
hooks/post-receive
--
phpMyAdmin
Show replies by date