diff --git a/db_details_importdocsql.php3 b/db_details_importdocsql.php3 new file mode 100644 index 000000000..cae622dcf --- /dev/null +++ b/db_details_importdocsql.php3 @@ -0,0 +1,99 @@ +Starting Import"; + if(substr($docpath,strlen($docpath)-2,1)!='/') { + $docpath = $docpath.'/'; + } + if (is_dir($docpath)) { + $handle = opendir($docpath); + while ($file = @readdir ($handle)) { + $_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 "" . $_line . "
"; + $_inf = explode('|',$_line); + if(!empty($_inf[1]) && strlen(trim($_inf[1]))>0){ + $qry = 'INSERT INTO ' . PMA_backquote($cfgRelation['column_comments']) + . ' (db_name, table_name, column_name, comment) ' + . ' VALUES(' + . '\'' . PMA_sqlAddslashes($db) . '\',' + . '\'' . 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 " . $_tab . '.' . $_inf[0] . "
"; + } else { + echo "writing of Comment not possible
"; + } + } + if (!empty($_inf[2]) && strlen(trim($_inf[2]))>0) { + $_for = explode('->',$_inf[2]); + + $qry = 'INSERT INTO ' . PMA_backquote($cfgRelation['relation']) + . '(master_db, master_table, master_field, foreign_db, foreign_table, foreign_field)' + . ' values(' + . '\'' . PMA_sqlAddslashes($db) . '\', ' + . '\'' . 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 " . $_tab . '.' . $_inf[0] . " to " . $_for . "
"; + } else { + echo "writing of Relation not possible
"; + } + } + } + echo 'Import finished
'; + } else { + echo "File could not be read
"; + } + }else { + echo "Ignoring File $file
"; + } + } + } else { + echo "This was not a Directory"; + } +} + +?> + \ No newline at end of file diff --git a/db_details_structure.php3 b/db_details_structure.php3 index cb98c6055..b3b15b7f7 100644 --- a/db_details_structure.php3 +++ b/db_details_structure.php3 @@ -508,15 +508,18 @@ if ($cfgRelation['pdfwork'] && $num_tables > 0) { - - -