bug #1567316, rename a db containing a view

This commit is contained in:
Marc Delisle
2006-10-18 12:24:16 +00:00
parent 76f6acbc6a
commit 356f3712f8
3 changed files with 38 additions and 2 deletions

View File

@@ -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,