From f7ef2d41ce01bd33d00afaeb101b48852bf4b59f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Chapeaux?= Date: Sun, 28 Apr 2002 11:42:40 +0000 Subject: [PATCH] Fixed bug #548495 - Alter table not replicate --- ChangeLog | 162 +++++++++++++++++++++++----------------------- tbl_addfield.php3 | 14 ++-- tbl_alter.php3 | 6 +- 3 files changed, 96 insertions(+), 86 deletions(-) diff --git a/ChangeLog b/ChangeLog index b76bab917..6492680ed 100755 --- a/ChangeLog +++ b/ChangeLog @@ -6,127 +6,129 @@ $Id$ $Source$ 2002-04-28 Marc Delisle - * tbl_properties.php3, new tbl_properties_common.php3: - start the split - * tbl_properties.php3, new tbl_properties_export.php3, - tbl_properties_links.php3, lang/*.php3: export is splitted - * new tbl_properties_table_info, to be able to display links - on the export page + * tbl_properties.php3, new tbl_properties_common.php3: + start the split + * tbl_properties.php3, new tbl_properties_export.php3, + tbl_properties_links.php3, lang/*.php3: export is splitted + * new tbl_properties_table_info, to be able to display links + on the export page 2002-04-28 Alexander M. Turek * header.inc.php3, lines 162-170: Improved patch #548696. 2002-04-28 Loïc Chapeaux - * tbl_properties.php3, line 395: replaced a "require" by an include. - * tbl_properties_links.php3: beautified code. + * tbl_properties.php3, line 395: replaced a "require" by an include. + * tbl_properties_links.php3: beautified code. * db_details.php3, tbl_change.php3, tbl_properties.php3, user_details.php3: xhtml fixes. * lang/slovak-win1250.inc.php3: updated thanks to Peter Svec. - * tbl_qbe.php3, line 732: fixed again a warning. + * tbl_qbe.php3, line 732: fixed again a warning. + * tbl_addfield.php3; tbl_alter.php3: fixed bug #548495 - Alter table not + replicate. 2002-04-27 Marc Delisle - * tbl_properties.php3, new tbl_properties_links.php3: - remove duplicate links code. + * tbl_properties.php3, new tbl_properties_links.php3: + remove duplicate links code. 2002-04-27 Alexander M. Turek - * Recompressed old ChangeLog without saving its path in the archive. - * header.inc.php3: - - Patch #548696 (DB/Table titles should be links), thanks to - Ray Black . - - lines: 161-164: Undefined variable. - * common.lib.php3, lines 162, 163, 435-437: Fixed bug #549570 - (Strange error if controluser is invalid). + * Recompressed old ChangeLog without saving its path in the archive. + * header.inc.php3: + - Patch #548696 (DB/Table titles should be links), thanks to + Ray Black . + - lines: 161-164: Undefined variable. + * common.lib.php3, lines 162, 163, 435-437: Fixed bug #549570 + (Strange error if controluser is invalid). 2002-04-27 Loïc Chapeaux - * Documentation.html: - - xhtml fixes; - - added a faq entry about bug #547064 (JS error with textareas under - Mozilla). - * libraries/display_tbl.lib.php3; libraries/functions.js: better fix - against bug #547384 (Marker Color can't equal Pointer Color). - * libraries/auth/config.auth.lib.php3, line 111: fixed a header problem. - * scripts/create-release.sh: improved so a CVS branch tag may be used. - * lang/croatian-*; libraries/select_lang.lib.php3: new Croatian - translations thanks to Sime Essert . - * tbl_properties.php3, lines 1238-1240: fix new fields names in the - relation table. - * tbl_printview.php3; tbl_qbe.php3: optimization, warnings and coding - standards. - * header.inc.php3, lines 166-172: xhtml fixes. - * Compressed ChangeLog till the 2.2.6 release. + * Documentation.html: + - xhtml fixes; + - added a faq entry about bug #547064 (JS error with textareas under + Mozilla). + * libraries/display_tbl.lib.php3; libraries/functions.js: better fix + against bug #547384 (Marker Color can't equal Pointer Color). + * libraries/auth/config.auth.lib.php3, line 111: fixed a header problem. + * scripts/create-release.sh: improved so a CVS branch tag may be used. + * lang/croatian-*; libraries/select_lang.lib.php3: new Croatian + translations thanks to Sime Essert . + * tbl_properties.php3, lines 1238-1240: fix new fields names in the + relation table. + * tbl_printview.php3; tbl_qbe.php3: optimization, warnings and coding + standards. + * header.inc.php3, lines 166-172: xhtml fixes. + * Compressed ChangeLog till the 2.2.6 release. 2002-04-26 Loïc Chapeaux - * ## created 2.2.7 branch into the CVS tree ## - * lang/nowegian.inc.php: updated thanks to Sven-Erik Andersen. - * lang/brazilian_portuguese.inc.php3: updated thanks to Renato Lins. - * sql.php3; tbl_replace.php3: patch #547030 - file_exists $goto thanks to - Melvyn Sopacua . - * libraries/common.lib.php3, line 70: "invalid" path. - * tbl_printview.php3; tbl_qbe.php3: coding standards and warnings. + * ## created 2.2.7 branch into the CVS tree ## + * lang/nowegian.inc.php: updated thanks to Sven-Erik Andersen. + * lang/brazilian_portuguese.inc.php3: updated thanks to Renato Lins. + * sql.php3; tbl_replace.php3: patch #547030 - file_exists $goto thanks to + Melvyn Sopacua . + * libraries/common.lib.php3, line 70: "invalid" path. + * tbl_printview.php3; tbl_qbe.php3: coding standards and warnings. 2002-04-26 Marc Delisle - * tbl_qbe.php3: automatic joints from Relation table, thanks - to Mike Beck (mike.beck at ibmiller.de) - (experimental: some things remain to be tested) - * Documentation.html: example for automatic joints - * tbl_qbe.php3, tbl_printview.php3, libraries/display_tbl.lib.php3, - Documentation.html: rename fields in the relation table + * tbl_qbe.php3: automatic joints from Relation table, thanks + to Mike Beck (mike.beck at ibmiller.de) + (experimental: some things remain to be tested) + * Documentation.html: example for automatic joints + * tbl_qbe.php3, tbl_printview.php3, libraries/display_tbl.lib.php3, + Documentation.html: rename fields in the relation table 2002-04-26 Alexander M. Turek - * libraries/common.lib.php3: fixed a controluser bug. - * libraries/display_tbl.lib.php3: fixed bug #547384 (Marker Color can't - equal Pointer Color) + * libraries/common.lib.php3: fixed a controluser bug. + * libraries/display_tbl.lib.php3: fixed bug #547384 (Marker Color can't + equal Pointer Color) 2002-04-25 Alexander M. Turek - * lang/italian.inc.php3: updated, thanks again to Pietro Danesi. + * lang/italian.inc.php3: updated, thanks again to Pietro Danesi. 2002-04-24 Marc Delisle - * tbl_*.php3: $cfg system changes + * tbl_*.php3: $cfg system changes 2002-04-24 Alexander M. Turek - * libraries/*, lang/*: $cfg system changes. - * libraries/common.lib.php3, libraries/select_lang.php3, - libraries/config_import.lib.php3: Config file backwards compatibility. + * libraries/*, lang/*: $cfg system changes. + * libraries/common.lib.php3, libraries/select_lang.php3, + libraries/config_import.lib.php3: Config file backwards compatibility. 2002-04-24 Robin Johnson - * *.php3 NOT tbl_*.php, Documentation.*: $cfg system changes. - * scripts/extchg.sh: Updated URL - * scripts/convertcfg.pl: Conversion between old config files and new ones. - * scripts/*: Updated comments somewhat - * tbl_dump.php3:121: renamed $cfgServer_backup to $backup_cfgServer - * user_details.php3: forgot to change $GLOBALS['cfgXYZ'] to $GLOBALS['cfg']['XYZ'] - * libraries/common.lib.php3: a single $cfgServer instance was forgotten + * *.php3 NOT tbl_*.php, Documentation.*: $cfg system changes. + * scripts/extchg.sh: Updated URL + * scripts/convertcfg.pl: Conversion between old config files and new ones. + * scripts/*: Updated comments somewhat + * tbl_dump.php3:121: renamed $cfgServer_backup to $backup_cfgServer + * user_details.php3: forgot to change $GLOBALS['cfgXYZ'] to $GLOBALS['cfg']['XYZ'] + * libraries/common.lib.php3: a single $cfgServer instance was forgotten 2002-04-23 Marc Delisle - * tbl_printview.php3, lang/*.php3: Relation links in printview, - thanks to Mike Beck (mike.beck at ibmiller.de) + * tbl_printview.php3, lang/*.php3: Relation links in printview, + thanks to Mike Beck (mike.beck at ibmiller.de) 2002-04-23 Alexander M. Turek - * libraries/common.lib.php3: fixed bug #547605 using Loïc's patch. - * tbl_printview.php3: Fixed a small bug, some php and XHTML 1.0 errors and - beautified the generated code. - * lang/german.inc.php3: Translated the new string. - * Documentation.html: Changed notes concerning php 4.2.0. + * libraries/common.lib.php3: fixed bug #547605 using Loïc's patch. + * tbl_printview.php3: Fixed a small bug, some php and XHTML 1.0 errors and + beautified the generated code. + * lang/german.inc.php3: Translated the new string. + * Documentation.html: Changed notes concerning php 4.2.0. 2002-04-22 Loïc Chapeaux - * lang/slovak-win1250.inc.php3: completed, thanks to Peter Svec. + * lang/slovak-win1250.inc.php3: completed, thanks to Peter Svec. 2002-04-22 Marc Delisle - * lang/japanese* updates, thanks to Yukihiro Kawada + * lang/japanese* updates, thanks to Yukihiro Kawada 2002-04-22 Alexander M. Turek - * lang/russian-koi8.inc.php3: fixed a typo (bug #546981). - * lang/german.inc.php3: better syntax. - * db_details.php3, mult_submits.inx.php3, tbl_properties.php3: - Use TRUNCATE instead of DELETE when using MySQL 4. + * lang/russian-koi8.inc.php3: fixed a typo (bug #546981). + * lang/german.inc.php3: better syntax. + * db_details.php3, mult_submits.inx.php3, tbl_properties.php3: + Use TRUNCATE instead of DELETE when using MySQL 4. 2002-04-21 Alexander M. Turek - * main.php3: Restarted work on patch #538740 (get users priv. with - SHOW GRANTS). + * main.php3: Restarted work on patch #538740 (get users priv. with + SHOW GRANTS). 2002-04-21 Loïc Chapeaux - * libraries/auth/http.auth.lib.php3: tried a fix to allow the use of http - authentication mode with IIS. + * libraries/auth/http.auth.lib.php3: tried a fix to allow the use of http + authentication mode with IIS. 2002-04-21 Marc Delisle - * ### 2.2.6 released ### + * ### 2.2.6 released ### diff --git a/tbl_addfield.php3 b/tbl_addfield.php3 index e421f9011..2ab70a25d 100755 --- a/tbl_addfield.php3 +++ b/tbl_addfield.php3 @@ -115,7 +115,11 @@ if (isset($submit)) { } // end for $query = ereg_replace(', ADD $', '', $query); - $sql_query = 'ALTER TABLE ' . PMA_backquote($db) . '.' . PMA_backquote($table) . ' ADD ' . $query; + // To allow replication, we first select the db to use and then run queries + // on this db. + $sql_query = 'USE ' . PMA_backquote($db); + $result = mysql_query($sql_query) or PMA_mysqlDie('', '', '', $err_url); + $sql_query = 'ALTER TABLE ' . PMA_backquote($table) . ' ADD ' . $query; $result = mysql_query($sql_query) or PMA_mysqlDie('', '', '', $err_url); $sql_query_cpy = $sql_query . ';'; @@ -129,7 +133,7 @@ if (isset($submit)) { } // end for $primary = ereg_replace(', $', '', $primary); if (!empty($primary)) { - $sql_query = 'ALTER TABLE ' . PMA_backquote($db) . '.' . PMA_backquote($table) . ' ADD PRIMARY KEY (' . $primary . ')'; + $sql_query = 'ALTER TABLE ' . PMA_backquote($table) . ' ADD PRIMARY KEY (' . $primary . ')'; $result = mysql_query($sql_query) or PMA_mysqlDie('', '', '', $err_url); $sql_query_cpy .= "\n" . $sql_query . ';'; } @@ -145,7 +149,7 @@ if (isset($submit)) { } // end for $index = ereg_replace(', $', '', $index); if (!empty($index)) { - $sql_query = 'ALTER TABLE ' . PMA_backquote($db) . '.' . PMA_backquote($table) . ' ADD INDEX (' . $index . ')'; + $sql_query = 'ALTER TABLE ' . PMA_backquote($table) . ' ADD INDEX (' . $index . ')'; $result = mysql_query($sql_query) or PMA_mysqlDie('', '', '', $err_url); $sql_query_cpy .= "\n" . $sql_query . ';'; } @@ -161,7 +165,7 @@ if (isset($submit)) { } // end for $unique = ereg_replace(', $', '', $unique); if (!empty($unique)) { - $sql_query = 'ALTER TABLE ' . PMA_backquote($db) . '.' . PMA_backquote($table) . ' ADD UNIQUE (' . $unique . ')'; + $sql_query = 'ALTER TABLE ' . PMA_backquote($table) . ' ADD UNIQUE (' . $unique . ')'; $result = mysql_query($sql_query) or PMA_mysqlDie('', '', '', $err_url); $sql_query_cpy .= "\n" . $sql_query . ';'; } @@ -178,7 +182,7 @@ if (isset($submit)) { } // end for $fulltext = ereg_replace(', $', '', $fulltext); if (!empty($fulltext)) { - $sql_query = 'ALTER TABLE ' . PMA_backquote($db) . '.' . PMA_backquote($table) . ' ADD FULLTEXT (' . $fulltext . ')'; + $sql_query = 'ALTER TABLE ' . PMA_backquote($table) . ' ADD FULLTEXT (' . $fulltext . ')'; $result = mysql_query($sql_query) or PMA_mysqlDie('', '', '', $err_url); $sql_query_cpy .= "\n" . $sql_query . ';'; } diff --git a/tbl_alter.php3 b/tbl_alter.php3 index c5d0b1d24..de7d47207 100755 --- a/tbl_alter.php3 +++ b/tbl_alter.php3 @@ -83,8 +83,12 @@ if (isset($submit)) { } } // end for + // To allow replication, we first select the db to use and then run queries + // on this db. + $sql_query = 'USE ' . PMA_backquote($db); + $result = mysql_query($sql_query) or PMA_mysqlDie('', '', '', $err_url); // Optimization fix - 2 May 2001 - Robbat2 - $sql_query = 'ALTER TABLE ' . PMA_backquote($db) . '.' . PMA_backquote($table) . ' CHANGE ' . $query; + $sql_query = 'ALTER TABLE ' . PMA_backquote($table) . ' CHANGE ' . $query; $result = mysql_query($sql_query) or PMA_mysqlDie('', '', '', $err_url); $message = $strTable . ' ' . htmlspecialchars($table) . ' ' . $strHasBeenAltered; $btnDrop = 'Fake';