bug [view] View renaming did not work

This commit is contained in:
Marc Delisle
2011-10-10 07:16:30 -04:00
parent 329c9cac68
commit 6fec80c614
2 changed files with 8 additions and 9 deletions

View File

@@ -4,6 +4,7 @@ phpMyAdmin - ChangeLog
3.4.7.0 (not yet released) 3.4.7.0 (not yet released)
- bug #3418610 [interface] Links in navigation when $cfg['MainPageIconic'] = false - bug #3418610 [interface] Links in navigation when $cfg['MainPageIconic'] = false
- bug #3418849 [interface] Inline edit shows dropdowns even after closing - bug #3418849 [interface] Inline edit shows dropdowns even after closing
- bug [view] View renaming did not work
3.4.6.0 (not yet released) 3.4.6.0 (not yet released)
- patch #3404173 InnoDB comment display with tooltips/aliases - patch #3404173 InnoDB comment display with tooltips/aliases

View File

@@ -1008,6 +1008,7 @@ class PMA_Table
* @param string new database name * @param string new database name
* @param boolean is this for a VIEW rename? * @param boolean is this for a VIEW rename?
* @return boolean success * @return boolean success
* @todo remove the $is_view parameter (also in callers)
*/ */
function rename($new_name, $new_db = null, $is_view = false) function rename($new_name, $new_db = null, $is_view = false)
{ {
@@ -1032,15 +1033,12 @@ class PMA_Table
return false; return false;
} }
if (! $is_view) { /*
* tested also for a view, in MySQL 5.0.92, 5.1.55 and 5.5.13
*/
$GLOBALS['sql_query'] = ' $GLOBALS['sql_query'] = '
RENAME TABLE ' . $this->getFullName(true) . ' RENAME TABLE ' . $this->getFullName(true) . '
TO ' . $new_table->getFullName(true) . ';'; TO ' . $new_table->getFullName(true) . ';';
} else {
$GLOBALS['sql_query'] = '
ALTER TABLE ' . $this->getFullName(true) . '
RENAME ' . $new_table->getFullName(true) . ';';
}
// I don't think a specific error message for views is necessary // I don't think a specific error message for views is necessary
if (! PMA_DBI_query($GLOBALS['sql_query'])) { if (! PMA_DBI_query($GLOBALS['sql_query'])) {
$this->errors[] = sprintf(__('Error renaming table %1$s to %2$s'), $this->getFullName(), $new_table->getFullName()); $this->errors[] = sprintf(__('Error renaming table %1$s to %2$s'), $this->getFullName(), $new_table->getFullName());