[Phpmyadmin-git] [SCM] phpMyAdmin branch, QA_3_3, updated. RELEASE_3_3_8-16-g63aec5b

Dieter Adriaenssens ruleant at users.sourceforge.net
Sun Nov 14 21:12:52 CET 2010


The branch, QA_3_3 has been updated
       via  63aec5b3280c39277c54d0789a1b511fd2f3b7ae (commit)
      from  8277c92e25ce1001c6b0479e91698bcf5c02c618 (commit)


- Log -----------------------------------------------------------------
-----------------------------------------------------------------------

Summary of changes:
 ChangeLog         |    1 +
 db_operations.php |   33 ++++++++++++++++++++-------------
 2 files changed, 21 insertions(+), 13 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index e9c8bef..0ed94ab 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -10,6 +10,7 @@ $HeadURL: https://phpmyadmin.svn.sourceforge.net/svnroot/phpmyadmin/trunk/phpMyA
 - 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 4004a3d..d3e62c2 100644
--- a/db_operations.php
+++ b/db_operations.php
@@ -125,14 +125,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;
             }
 
@@ -190,13 +191,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




More information about the Git mailing list