From 485fe0efa37bfa8747e29339bd58ee0f989b4edb Mon Sep 17 00:00:00 2001 From: Mike Beck Date: Fri, 20 Sep 2002 06:50:40 +0000 Subject: [PATCH] of course i should add the file to cvs before trying to commit ;-| --- db_details_importdocsql.php3 | 99 ++++++++++++++++++++++++++++++++++++ db_details_structure.php3 | 13 +++-- 2 files changed, 107 insertions(+), 5 deletions(-) create mode 100644 db_details_importdocsql.php3 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 "

Working on Table " . $_tab . "

"; + $fd = fopen($docpath . $file, "r"); + if($fd) { + while (!feof($fd)) { + $_line = fgets($fd, 4096); + //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"; + } +} + +?> +
+ + + + + + + + + + + +
Used Database:
Please enter absolute path on webserver to docSQL 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) {    - - -
  • -
  • 0 + && $cfgRelation['relwork'] && $cfgRelation['commwork']) { + ?> + +
  • +
    +
  • ';