patch #1253461, code cleanup

This commit is contained in:
Marc Delisle
2005-08-08 19:54:57 +00:00
parent 5b081dabb8
commit e1f455d072
4 changed files with 21 additions and 18 deletions

View File

@@ -8,6 +8,9 @@ $Source$
2005-08-08 Marc Delisle <lem9@users.sourceforge.net> 2005-08-08 Marc Delisle <lem9@users.sourceforge.net>
* libraries/dbi/mysqli.dbi.lib.php: bug #1253453, using mysqli extension * libraries/dbi/mysqli.dbi.lib.php: bug #1253453, using mysqli extension
with MySQL 4.0.x with MySQL 4.0.x
* libraries/mysql_charsets.lib.php, /relation_cleanup.lib.php,
/tbl_move_copy.php: patch #1253461 (code cleanup),
thanks to Sebastian Mendel
2005-08-07 Marc Delisle <lem9@users.sourceforge.net> 2005-08-07 Marc Delisle <lem9@users.sourceforge.net>
* Documentation.html: Save button for PDF schema coordinates, * Documentation.html: Save button for PDF schema coordinates,

View File

@@ -286,7 +286,7 @@ if (PMA_MYSQL_INT_VERSION >= 40100){
$row = PMA_DBI_fetch_row($res); $row = PMA_DBI_fetch_row($res);
PMA_DBI_free_result($res); PMA_DBI_free_result($res);
$tokenized = explode(' ', $row[1]); $tokenized = explode(' ', $row[1]);
unset($row, $res, $sql_query); unset($row, $res);
for ($i = 1; $i + 3 < count($tokenized); $i++) { for ($i = 1; $i + 3 < count($tokenized); $i++) {
if ($tokenized[$i] == 'DEFAULT' && $tokenized[$i + 1] == 'CHARACTER' && $tokenized[$i + 2] == 'SET') { if ($tokenized[$i] == 'DEFAULT' && $tokenized[$i + 1] == 'CHARACTER' && $tokenized[$i + 2] == 'SET') {

View File

@@ -18,7 +18,7 @@ function PMA_relationsCleanupColumn($db, $table, $column) {
. ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\'' . ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\''
. ' AND column_name = \'' . PMA_sqlAddslashes(urldecode($column)) . '\''; . ' AND column_name = \'' . PMA_sqlAddslashes(urldecode($column)) . '\'';
$rmv_rs = PMA_query_as_cu($remove_query); $rmv_rs = PMA_query_as_cu($remove_query);
unset($rmv_query); unset($remove_query);
} }
if ($cfgRelation['displaywork']) { if ($cfgRelation['displaywork']) {
@@ -27,7 +27,7 @@ function PMA_relationsCleanupColumn($db, $table, $column) {
. ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\'' . ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\''
. ' AND display_field = \'' . PMA_sqlAddslashes(urldecode($column)) . '\''; . ' AND display_field = \'' . PMA_sqlAddslashes(urldecode($column)) . '\'';
$rmv_rs = PMA_query_as_cu($remove_query); $rmv_rs = PMA_query_as_cu($remove_query);
unset($rmv_query); unset($remove_query);
} }
if ($cfgRelation['relwork']) { if ($cfgRelation['relwork']) {
@@ -36,14 +36,14 @@ function PMA_relationsCleanupColumn($db, $table, $column) {
. ' AND master_table = \'' . PMA_sqlAddslashes($table) . '\'' . ' AND master_table = \'' . PMA_sqlAddslashes($table) . '\''
. ' AND master_field = \'' . PMA_sqlAddslashes(urldecode($column)) . '\''; . ' AND master_field = \'' . PMA_sqlAddslashes(urldecode($column)) . '\'';
$rmv_rs = PMA_query_as_cu($remove_query); $rmv_rs = PMA_query_as_cu($remove_query);
unset($rmv_query); unset($remove_query);
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['relation']) $remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['relation'])
. ' WHERE foreign_db = \'' . PMA_sqlAddslashes($db) . '\'' . ' WHERE foreign_db = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND foreign_table = \'' . PMA_sqlAddslashes($table) . '\'' . ' AND foreign_table = \'' . PMA_sqlAddslashes($table) . '\''
. ' AND foreign_field = \'' . PMA_sqlAddslashes(urldecode($column)) . '\''; . ' AND foreign_field = \'' . PMA_sqlAddslashes(urldecode($column)) . '\'';
$rmv_rs = PMA_query_as_cu($remove_query); $rmv_rs = PMA_query_as_cu($remove_query);
unset($rmv_query); unset($remove_query);
} }
} }
@@ -55,7 +55,7 @@ function PMA_relationsCleanupTable($db, $table) {
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'' . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\''; . ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\'';
$rmv_rs = PMA_query_as_cu($remove_query); $rmv_rs = PMA_query_as_cu($remove_query);
unset($rmv_query); unset($remove_query);
} }
if ($cfgRelation['displaywork']) { if ($cfgRelation['displaywork']) {
@@ -63,7 +63,7 @@ function PMA_relationsCleanupTable($db, $table) {
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'' . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\''; . ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\'';
$rmv_rs = PMA_query_as_cu($remove_query); $rmv_rs = PMA_query_as_cu($remove_query);
unset($rmv_query); unset($remove_query);
} }
if ($cfgRelation['pdfwork']) { if ($cfgRelation['pdfwork']) {
@@ -71,7 +71,7 @@ function PMA_relationsCleanupTable($db, $table) {
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'' . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\''; . ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\'';
$rmv_rs = PMA_query_as_cu($remove_query); $rmv_rs = PMA_query_as_cu($remove_query);
unset($rmv_query); unset($remove_query);
} }
if ($cfgRelation['relwork']) { if ($cfgRelation['relwork']) {
@@ -79,13 +79,13 @@ function PMA_relationsCleanupTable($db, $table) {
. ' WHERE master_db = \'' . PMA_sqlAddslashes($db) . '\'' . ' WHERE master_db = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND master_table = \'' . PMA_sqlAddslashes($table) . '\''; . ' AND master_table = \'' . PMA_sqlAddslashes($table) . '\'';
$rmv_rs = PMA_query_as_cu($remove_query); $rmv_rs = PMA_query_as_cu($remove_query);
unset($rmv_query); unset($remove_query);
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['relation']) $remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['relation'])
. ' WHERE foreign_db = \'' . PMA_sqlAddslashes($db) . '\'' . ' WHERE foreign_db = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND foreign_table = \'' . PMA_sqlAddslashes($table) . '\''; . ' AND foreign_table = \'' . PMA_sqlAddslashes($table) . '\'';
$rmv_rs = PMA_query_as_cu($remove_query); $rmv_rs = PMA_query_as_cu($remove_query);
unset($rmv_query); unset($remove_query);
} }
} }
@@ -96,45 +96,45 @@ function PMA_relationsCleanupDatabase($db) {
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['column_info']) $remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['column_info'])
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''; . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'';
$rmv_rs = PMA_query_as_cu($remove_query); $rmv_rs = PMA_query_as_cu($remove_query);
unset($rmv_query); unset($remove_query);
} }
if ($cfgRelation['bookmarkwork']) { if ($cfgRelation['bookmarkwork']) {
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['bookmark']) $remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['bookmark'])
. ' WHERE dbase = \'' . PMA_sqlAddslashes($db) . '\''; . ' WHERE dbase = \'' . PMA_sqlAddslashes($db) . '\'';
$rmv_rs = PMA_query_as_cu($remove_query); $rmv_rs = PMA_query_as_cu($remove_query);
unset($rmv_query); unset($remove_query);
} }
if ($cfgRelation['displaywork']) { if ($cfgRelation['displaywork']) {
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['table_info']) $remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['table_info'])
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''; . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'';
$rmv_rs = PMA_query_as_cu($remove_query); $rmv_rs = PMA_query_as_cu($remove_query);
unset($rmv_query); unset($remove_query);
} }
if ($cfgRelation['pdfwork']) { if ($cfgRelation['pdfwork']) {
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['pdf_pages']) $remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['pdf_pages'])
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''; . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'';
$rmv_rs = PMA_query_as_cu($remove_query); $rmv_rs = PMA_query_as_cu($remove_query);
unset($rmv_query); unset($remove_query);
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['table_coords']) $remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['table_coords'])
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''; . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'';
$rmv_rs = PMA_query_as_cu($remove_query); $rmv_rs = PMA_query_as_cu($remove_query);
unset($rmv_query); unset($remove_query);
} }
if ($cfgRelation['relwork']) { if ($cfgRelation['relwork']) {
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['relation']) $remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['relation'])
. ' WHERE master_db = \'' . PMA_sqlAddslashes($db) . '\''; . ' WHERE master_db = \'' . PMA_sqlAddslashes($db) . '\'';
$rmv_rs = PMA_query_as_cu($remove_query); $rmv_rs = PMA_query_as_cu($remove_query);
unset($rmv_query); unset($remove_query);
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['relation']) $remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['relation'])
. ' WHERE foreign_db = \'' . PMA_sqlAddslashes($db) . '\''; . ' WHERE foreign_db = \'' . PMA_sqlAddslashes($db) . '\'';
$rmv_rs = PMA_query_as_cu($remove_query); $rmv_rs = PMA_query_as_cu($remove_query);
unset($rmv_query); unset($remove_query);
} }
} }

View File

@@ -220,7 +220,7 @@ function PMA_table_move_copy($source_db, $source_table, $target_db, $target_tabl
. ' WHERE db_name = \'' . PMA_sqlAddslashes($source_db) . '\'' . ' WHERE db_name = \'' . PMA_sqlAddslashes($source_db) . '\''
. ' AND table_name = \'' . PMA_sqlAddslashes($source_table) . '\''; . ' AND table_name = \'' . PMA_sqlAddslashes($source_table) . '\'';
$rmv_rs = PMA_query_as_cu($remove_query); $rmv_rs = PMA_query_as_cu($remove_query);
unset($rmv_query); unset($remove_query);
} }
// garvin: updating bookmarks is not possible since only a single table is moved, // garvin: updating bookmarks is not possible since only a single table is moved,