bug #1567316, rename a db containing a view
This commit is contained in:
@@ -52,7 +52,18 @@ if (isset($db) &&
|
||||
}
|
||||
|
||||
$tables_full = PMA_DBI_get_tables_full($db);
|
||||
$views = array();
|
||||
foreach ($tables_full as $table => $tmp) {
|
||||
// to be able to rename a db containing views, we
|
||||
// first collect in $views all the views we find and we
|
||||
// will handle them after the tables; however, this
|
||||
// does not support the case when a view is based on a view
|
||||
|
||||
if (PMA_Table::isView($db, $table)) {
|
||||
$views[] = $table;
|
||||
continue;
|
||||
}
|
||||
|
||||
$back = $sql_query;
|
||||
$sql_query = '';
|
||||
|
||||
@@ -83,9 +94,16 @@ if (isset($db) &&
|
||||
}
|
||||
|
||||
$sql_query = $back . $sql_query;
|
||||
}
|
||||
} // end (foreach)
|
||||
unset($table);
|
||||
|
||||
// handle the views
|
||||
foreach ($views as $view) {
|
||||
PMA_Table::moveCopy($db, $view, $newname, $view,
|
||||
'structure', $move, 'db_copy');
|
||||
}
|
||||
unset($view, $views);
|
||||
|
||||
// now that all tables exist, create all the accumulated constraints
|
||||
if (isset($GLOBALS['add_constraints'])) {
|
||||
// FIXME: this works with mysqli but not with mysql,
|
||||
|
Reference in New Issue
Block a user