Changes needed for 2009AB version of UMLS
[umlisp.git] / create-sql.lisp
index 93c90d541af858522d8ec657aca23e6e15aa7b13..79732ebc649e4cc5816049944be951ce9f6ac470 100644 (file)
@@ -7,10 +7,8 @@
 ;;;; Author:   Kevin M. Rosenberg
 ;;;; Created:  Apr 2000
 ;;;;
-;;;; $Id$
-;;;;
 ;;;; This file, part of UMLisp, is
-;;;;    Copyright (c) 2000-2006 by Kevin M. Rosenberg, M.D.
+;;;;    Copyright (c) 2000-2010 by Kevin M. Rosenberg, M.D.
 ;;;;
 ;;;; UMLisp users are granted the rights to distribute and use this software
 ;;;; as governed by the terms of the GNU General Public License.
@@ -264,15 +262,15 @@ This is much faster that using create-umls-db-insert."
       (dolist (file *umls-files*)
         (when verbose (format t "UMLS Import: Importing file ~A to SQL.~%" (fil file)))
         (sql-execute (funcall copy-cmd file extension) conn))
-      (When verbose (format t "UMLS Import: Creating SQL indices.~%"))
+      (when verbose (format t "UMLS Import: Creating SQL indices.~%"))
       (sql-create-indexes conn :verbose verbose)
-      (When verbose (format t "UMLS Import: Creating custom tables.~%"))
+      (when verbose (format t "UMLS Import: Creating custom tables.~%"))
       (sql-create-custom-tables conn)
-      (When verbose (format t "UMLS Import: Creating custom indices.~%"))
+      (when verbose (format t "UMLS Import: Creating custom indices.~%"))
       (sql-create-indexes conn :indexes +custom-index-cols+ :verbose verbose)
-      (When verbose (format t "UMLS Import: Creating special tables.~%"))
+      (when verbose (format t "UMLS Import: Creating special tables.~%"))
       (sql-create-special-tables conn)))
-  (When verbose (format t "UMLS Import: Completed.~%"))
+  (when verbose (format t "UMLS Import: Completed.~%"))
   t)
 
 (defun translate-all-files (&key (extension "-trans") verbose force)
@@ -300,6 +298,12 @@ This is much faster that using create-umls-db-insert."
           (eof (cons nil nil)))
       (catch 'done-counting
         (with-open-file (ts output-path :direction :input
+                            #+(and sbcl sb-unicode) :external-format
+                            #+(and sbcl sb-unicode) :UTF-8
+                            #+(and allegro ics) :external-format
+                            #+(and allegro ics) :UTF-8
+                            #+lispworks :external-format
+                            #+lispworks :UTF-8
                             #+(and clisp unicode) :external-format
                             #+(and clisp unicode) charset:utf-8)
           (do ()
@@ -335,6 +339,12 @@ This is much faster that using create-umls-db-insert."
     (with-open-file (ostream output-path :direction :output
                              :if-exists :overwrite
                              :if-does-not-exist :create
+                             #+(and sbcl sb-unicode) :external-format
+                             #+(and sbcl sb-unicode) :UTF-8
+                             #+(and allegro ics) :external-format
+                             #+(and allegro ics) :UTF-8
+                             #+lispworks :external-format
+                             #+lispworks :UTF-8
                              #+(and clisp unicode) :external-format
                              #+(and clisp unicode) charset:utf-8)
       (dolist (input-ufile input-ufiles)
@@ -366,7 +376,7 @@ This is much faster that using create-umls-db-insert."
   "Return mysql copy statement for a file"
   (format
    nil
-   "LOAD DATA ~AINFILE \"~a\" INTO TABLE ~a FIELDS TERMINATED BY \"|\""
+   "LOAD DATA ~AINFILE '~a' INTO TABLE ~a FIELDS TERMINATED BY '|'"
    (if local-file "LOCAL " "")
    (namestring (ufile-pathname file extension)) (table file)))