From 16e55c21f2f12b2b815739823040b64c740eae66 Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Wed, 26 Sep 2007 16:51:27 +0000 Subject: [PATCH] bug #1764735 [core] Designer: PDF error when deleting a table --- ChangeLog | 1 + libraries/Table.class.php | 29 +++++++++++++++++++++++++++++ libraries/relation_cleanup.lib.php | 15 +++++++++++++++ 3 files changed, 45 insertions(+) diff --git a/ChangeLog b/ChangeLog index 225cb513f..e70c97bf5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -11,6 +11,7 @@ $HeadURL: https://phpmyadmin.svn.sourceforge.net/svnroot/phpmyadmin/trunk/phpMyA - bug #1798841 [relations] Copying db does not copy internal relations - bug #1798646 [display] Character '+' in query wrongly interpreted - bug #1801919 [themes] Do not use NaviDatabaseNameColor for fieldset legend +- bug #1764735 [core] Designer: PDF error when deleting a table 2.11.1.0 (2007-09-20) diff --git a/libraries/Table.class.php b/libraries/Table.class.php index afa0f20c0..f063d4957 100644 --- a/libraries/Table.class.php +++ b/libraries/Table.class.php @@ -798,8 +798,19 @@ class PMA_Table { */ } + if ($GLOBALS['cfgRelation']['designerwork']) { + $table_query = 'UPDATE ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($GLOBALS['cfgRelation']['designer_coords']) + . ' SET table_name = \'' . PMA_sqlAddslashes($target_table) . '\',' + . ' db_name = \'' . PMA_sqlAddslashes($target_db) . '\'' + . ' WHERE db_name = \'' . PMA_sqlAddslashes($source_db) . '\'' + . ' AND table_name = \'' . PMA_sqlAddslashes($source_table) . '\''; + PMA_query_as_cu($table_query); + unset($table_query); + } $GLOBALS['sql_query'] .= "\n\n" . $sql_drop_query . ';'; + // end if ($move) } else { + // we are copying // garvin: Create new entries as duplicates from old PMA DBs if ($what != 'dataonly' && !isset($maintain_relations)) { if ($GLOBALS['cfgRelation']['commwork']) { @@ -853,6 +864,12 @@ class PMA_Table { $where_fields = array('foreign_db' => $source_db, 'foreign_table' => $source_table); $new_fields = array('master_db' => $target_db, 'foreign_db' => $target_db, 'foreign_table' => $target_table); PMA_Table::duplicateInfo('relwork', 'relation', $get_fields, $where_fields, $new_fields); + + + $get_fields = array('x', 'y', 'v', 'h'); + $where_fields = array('db_name' => $source_db, 'table_name' => $source_table); + $new_fields = array('db_name' => $target_db, 'table_name' => $target_table); + PMA_Table::duplicateInfo('designerwork', 'designer_coords', $get_fields, $where_fields, $new_fields); /** * @todo garvin: Can't get duplicating PDFs the right way. The @@ -1013,6 +1030,18 @@ class PMA_Table { unset($table_query); } + if ($GLOBALS['cfgRelation']['designerwork']) { + $table_query = ' + UPDATE ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' + . PMA_backquote($GLOBALS['cfgRelation']['designer_coords']) . ' + SET `db_name` = \'' . PMA_sqlAddslashes($new_db) . '\', + `table_name` = \'' . PMA_sqlAddslashes($new_name) . '\' + WHERE `db_name` = \'' . PMA_sqlAddslashes($old_db) . '\' + AND `table_name` = \'' . PMA_sqlAddslashes($old_name) . '\''; + PMA_query_as_cu($table_query); + unset($table_query); + } + $this->messages[] = sprintf($GLOBALS['strRenameTableOK'], htmlspecialchars($old_name), htmlspecialchars($new_name)); return true; diff --git a/libraries/relation_cleanup.lib.php b/libraries/relation_cleanup.lib.php index 65d034e9d..62ecce944 100644 --- a/libraries/relation_cleanup.lib.php +++ b/libraries/relation_cleanup.lib.php @@ -76,6 +76,14 @@ function PMA_relationsCleanupTable($db, $table) { unset($remove_query); } + if ($cfgRelation['designerwork']) { + $remove_query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['designer_coords']) + . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'' + . ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\''; + $rmv_rs = PMA_query_as_cu($remove_query); + unset($remove_query); + } + if ($cfgRelation['relwork']) { $remove_query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['relation']) . ' WHERE master_db = \'' . PMA_sqlAddslashes($db) . '\'' @@ -127,6 +135,13 @@ function PMA_relationsCleanupDatabase($db) { unset($remove_query); } + if ($cfgRelation['designerwork']) { + $remove_query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['designer_coords']) + . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''; + $rmv_rs = PMA_query_as_cu($remove_query); + unset($remove_query); + } + if ($cfgRelation['relwork']) { $remove_query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['relation']) . ' WHERE master_db = \'' . PMA_sqlAddslashes($db) . '\'';