diff options
author | Madhura Jayaratne <madhura.cj@gmail.com> | 2011-12-06 17:11:04 +0400 |
---|---|---|
committer | Madhura Jayaratne <madhura.cj@gmail.com> | 2011-12-06 17:11:04 +0400 |
commit | 5f78897bc8eadf5b399b9b4118bdb575f9f3e0a3 (patch) | |
tree | f83fbb4e42cf17fc0459f3eb487f2345ef95da0c /db_operations.php | |
parent | b02f4eec076ded51f258bb00c697ac72c13a9606 (diff) |
bug #3306875 [edit] Can't rename a database that contains views
Diffstat (limited to 'db_operations.php')
-rw-r--r-- | db_operations.php | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/db_operations.php b/db_operations.php index ebd9333d3c..f516a6457d 100644 --- a/db_operations.php +++ b/db_operations.php @@ -124,7 +124,6 @@ if (strlen($db) && (! empty($db_rename) || ! empty($db_copy))) { } unset($sql_constraints, $sql_drop_foreign_keys, $sql_structure); - foreach ($tables_full as $each_table => $tmp) { // to be able to rename a db containing views, // first all the views are collected and a stand-in is created @@ -133,11 +132,17 @@ if (strlen($db) && (! empty($db_rename) || ! empty($db_copy))) { $views[] = $each_table; // Create stand-in definition to resolve view dependencies $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 . ';'; - continue; } + } + foreach ($tables_full as $each_table => $tmp) { + // skip the views; we have creted stand-in definitions + if (PMA_Table::isView($db, $each_table)) { + continue; + } $back = $sql_query; $sql_query = ''; |