From ee73f75616c5dbbce7e31711a05d0456b5e55084 Mon Sep 17 00:00:00 2001 From: Mike Beck Date: Thu, 26 Sep 2002 14:28:13 +0000 Subject: [PATCH] Bugfix thx to aresh yawari: if tables had _ in their names it did not work --- db_details_importdocsql.php3 | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/db_details_importdocsql.php3 b/db_details_importdocsql.php3 index 4c31cbe5a..49a4ea179 100644 --- a/db_details_importdocsql.php3 +++ b/db_details_importdocsql.php3 @@ -29,12 +29,13 @@ if (isset($do) && $do == 'import') { if (is_dir($docpath)) { $handle = opendir($docpath); while ($file = @readdir ($handle)) { - $filename = basename($file); + $_filename = basename($file); // echo '

Working on file ' . $filename . '

'; - $parts = explode('_', $filename); - if (count($parts) == 3 && $parts[1] == 'field' && $parts[2] == 'comment.txt') { - $tab = $parts[0]; - //echo '

Working on Table ' . $tab . '

'; + + if (strpos($_filename,"_field_comment.txt")!=false) + { + $_tab = substr($_filename,0,strlen($_filename)-strlen("_field_comment.txt")); + //echo '

Working on Table ' . $_tab . '

'; $fd = fopen($docpath . $file, 'r'); if ($fd) { while (!feof($fd)) { @@ -46,11 +47,11 @@ if (isset($do) && $do == 'import') { . ' (db_name, table_name, column_name, comment) ' . ' VALUES(' . '\'' . PMA_sqlAddslashes($db) . '\',' - . '\'' . PMA_sqlAddslashes(trim($tab)) . '\',' + . '\'' . PMA_sqlAddslashes(trim($_tab)) . '\',' . '\'' . PMA_sqlAddslashes(trim($inf[0])) . '\',' . '\'' . PMA_sqlAddslashes(trim($inf[1])) . '\')'; if (PMA_query_as_cu($qry)) { - echo '

Added comment for column ' . htmlspecialchars($tab) . '.' . htmlspecialchars($inf[0]) . '

'; + echo '

Added comment for column ' . htmlspecialchars($_tab) . '.' . htmlspecialchars($inf[0]) . '

'; } else { echo '

Writing of comment not possible

'; } @@ -62,13 +63,13 @@ if (isset($do) && $do == 'import') { . '(master_db, master_table, master_field, foreign_db, foreign_table, foreign_field)' . ' VALUES(' . '\'' . PMA_sqlAddslashes($db) . '\', ' - . '\'' . PMA_sqlAddslashes(trim($tab)) . '\', ' + . '\'' . PMA_sqlAddslashes(trim($_tab)) . '\', ' . '\'' . PMA_sqlAddslashes(trim($inf[0])) . '\', ' . '\'' . PMA_sqlAddslashes($db) . '\', ' . '\'' . PMA_sqlAddslashes(trim($for[0])) . '\',' . '\'' . PMA_sqlAddslashes(trim($for[1])) . '\')'; if (PMA_query_as_cu($qry)) { - echo '

Added relation for column ' . htmlspecialchars($tab) . '.' . htmlspecialchars($inf[0]) . ' to ' . htmlspecialchars($for) . '

'; + echo '

Added relation for column ' . htmlspecialchars($_tab) . '.' . htmlspecialchars($inf[0]) . ' to ' . htmlspecialchars($for) . '

'; } else { echo "

writing of Relation not possible

"; }