The branch, master has been updated
via 65fcab4122a8feafc07427d2567b919c48b2fa77 (commit)
via 63aec5b3280c39277c54d0789a1b511fd2f3b7ae (commit)
from 57c5abf579d7ee37eeea5c44c2c62360bd5fe529 (commit)
- Log -----------------------------------------------------------------
commit 65fcab4122a8feafc07427d2567b919c48b2fa77
Merge: 57c5abf579d7ee37eeea5c44c2c62360bd5fe529 63aec5b3280c39277c54d0789a1b511fd2f3b7ae
Author: Dieter Adriaenssens <ruleant(a)users.sourceforge.net>
Date: Sun Nov 14 21:08:28 2010 +0100
Merge branch 'QA_3_3'
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 1 +
db_operations.php | 33 ++++++++++++++++++++-------------
2 files changed, 21 insertions(+), 13 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index d3bd70e..92a3a50 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -124,6 +124,7 @@
- patch #3101490 Default function for TIMESTAMP, thanks to jirand - jirand
- bug #3103853 [js] Double quotes were not escaped in generated js
- bug #3077463 [core] Events were not copied when copying/renaming database
+- bug #1762306 [core] Copy database with view of a view
3.3.8.0 (2010-10-25)
- bug #3059311 [import] BIGINT field type added to table analysis
diff --git a/db_operations.php b/db_operations.php
index b5d7f5a..c9aa565 100644
--- a/db_operations.php
+++ b/db_operations.php
@@ -128,14 +128,15 @@ if (strlen($db) && (! empty($db_rename) || !
empty($db_copy))) {
foreach ($tables_full as $each_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
- /**
- * @todo support a view of a view
- */
+ // to be able to rename a db containing views,
+ // first all the views are collected and a stand-in is created
+ // the real views are created after the tables
if (PMA_Table::isView($db, $each_table)) {
$views[] = $each_table;
+ // Create stand-in definition to resolve view dependencies
+ $sql_view_standin = PMA_getTableDefStandIn($db, $each_table, "\n");
+ PMA_DBI_query($sql_view_standin);
+ $GLOBALS['sql_query'] .= "\n" . $sql_view_standin . ';';
continue;
}
@@ -193,13 +194,19 @@ if (strlen($db) && (! empty($db_rename) || !
empty($db_copy))) {
// handle the views
if (! $_error) {
- foreach ($views as $view) {
- if (! PMA_Table::moveCopy($db, $view, $newname, $view,
- 'structure', $move, 'db_copy')) {
- $_error = true;
- break;
- }
- }
+ // temporarily force to add DROP IF EXIST to CREATE VIEW query,
+ // to remove stand-in VIEW that was created earlier
+ $temp_drop_if_exists = $GLOBALS['drop_if_exists'];
+ $GLOBALS['drop_if_exists'] = 'true';
+
+ foreach ($views as $view) {
+ if (! PMA_Table::moveCopy($db, $view, $newname, $view, 'structure', $move,
'db_copy')) {
+ $_error = true;
+ break;
+ }
+ }
+ // restore previous value
+ $GLOBALS['drop_if_exists'] = $temp_drop_if_exists;
}
unset($view, $views);
hooks/post-receive
--
phpMyAdmin