From 6fec80c61445dc11b4ff3023947b9882e163d382 Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Mon, 10 Oct 2011 07:16:30 -0400 Subject: [PATCH] bug [view] View renaming did not work --- ChangeLog | 1 + libraries/Table.class.php | 16 +++++++--------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index f884d4a938..100a933baf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,7 @@ phpMyAdmin - ChangeLog 3.4.7.0 (not yet released) - bug #3418610 [interface] Links in navigation when $cfg['MainPageIconic'] = false - bug #3418849 [interface] Inline edit shows dropdowns even after closing +- bug [view] View renaming did not work 3.4.6.0 (not yet released) - patch #3404173 InnoDB comment display with tooltips/aliases diff --git a/libraries/Table.class.php b/libraries/Table.class.php index a29900e7b5..d7af2d7e2e 100644 --- a/libraries/Table.class.php +++ b/libraries/Table.class.php @@ -1008,6 +1008,7 @@ class PMA_Table * @param string new database name * @param boolean is this for a VIEW rename? * @return boolean success + * @todo remove the $is_view parameter (also in callers) */ function rename($new_name, $new_db = null, $is_view = false) { @@ -1032,15 +1033,12 @@ class PMA_Table return false; } - if (! $is_view) { - $GLOBALS['sql_query'] = ' - RENAME TABLE ' . $this->getFullName(true) . ' - TO ' . $new_table->getFullName(true) . ';'; - } else { - $GLOBALS['sql_query'] = ' - ALTER TABLE ' . $this->getFullName(true) . ' - RENAME ' . $new_table->getFullName(true) . ';'; - } + /* + * tested also for a view, in MySQL 5.0.92, 5.1.55 and 5.5.13 + */ + $GLOBALS['sql_query'] = ' + RENAME TABLE ' . $this->getFullName(true) . ' + TO ' . $new_table->getFullName(true) . ';'; // I don't think a specific error message for views is necessary if (! PMA_DBI_query($GLOBALS['sql_query'])) { $this->errors[] = sprintf(__('Error renaming table %1$s to %2$s'), $this->getFullName(), $new_table->getFullName()); -- 2.11.4.GIT