projects
/
umlisp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
r4883: Auto commit for Debian build
[umlisp.git]
/
create-sql.lisp
diff --git
a/create-sql.lisp
b/create-sql.lisp
index e81440d1c51be43f40025f82598bdd06c9830ade..4367e1d4f216371ab93435b9dc277153e87ede73 100644
(file)
--- a/
create-sql.lisp
+++ b/
create-sql.lisp
@@
-7,7
+7,7
@@
;;;; Author: Kevin M. Rosenberg
;;;; Date Started: Apr 2000
;;;;
;;;; Author: Kevin M. Rosenberg
;;;; Date Started: Apr 2000
;;;;
-;;;; $Id: create-sql.lisp,v 1.
1 2003/05/07 21:57:06
kevin Exp $
+;;;; $Id: create-sql.lisp,v 1.
4 2003/05/09 00:06:38
kevin Exp $
;;;;
;;;; This file, part of UMLisp, is
;;;; Copyright (c) 2000-2002 by Kevin M. Rosenberg, M.D.
;;;;
;;;; This file, part of UMLisp, is
;;;; Copyright (c) 2000-2002 by Kevin M. Rosenberg, M.D.
@@
-49,8
+49,9
@@
"Return sql insert command for a row of values"
(let ((insert-func
(lambda (col value)
"Return sql insert command for a row of values"
(let ((insert-func
(lambda (col value)
- (let ((q (quotechar col)))
- (concatenate 'string q (insert-col-value col value) q)))))
+ (concatenate 'string (quote-str col)
+ (insert-col-value col value)
+ (quote-str col)))))
(format
nil "INSERT INTO ~a (~{~a~^,~}) VALUES (~A)"
(table file)
(format
nil "INSERT INTO ~a (~{~a~^,~}) VALUES (~A)"
(table file)
@@
-65,8
+66,9
@@
(let ((custom-value (funcall (custom-value-fun col) values)))
(if custom-value
(if doquote
(let ((custom-value (funcall (custom-value-fun col) values)))
(if custom-value
(if doquote
- (let ((q (quotechar col)))
- (concatenate 'string q (escape-backslashes custom-value) q))
+ (concatenate 'string (quote-str col)
+ (escape-backslashes custom-value)
+ (quote-str col))
(escape-backslashes custom-value))
"")))
(escape-backslashes custom-value))
"")))
@@
-159,8
+161,8
@@
(defun create-umls-db-by-insert ()
"SQL Databases: initializes entire database via SQL insert commands"
(defun create-umls-db-by-insert ()
"SQL Databases: initializes entire database via SQL insert commands"
- (ensure-
init-uml
s)
- (
init-hash-tabl
e)
+ (ensure-
ucols+ufile
s)
+ (
ensure-prepars
e)
(with-sql-connection (conn)
(sql-drop-tables conn)
(sql-create-tables conn)
(with-sql-connection (conn)
(sql-drop-tables conn)
(sql-create-tables conn)
@@
-174,8
+176,8
@@
(copy-cmd #'mysql-copy-cmd))
"SQL Databases: initializes entire database via SQL copy commands.
This is much faster that using create-umls-db-insert."
(copy-cmd #'mysql-copy-cmd))
"SQL Databases: initializes entire database via SQL copy commands.
This is much faster that using create-umls-db-insert."
- (ensure-
init-uml
s)
- (
init-hash-tabl
e)
+ (ensure-
ucols+ufile
s)
+ (
ensure-prepars
e)
(translate-all-files extension)
(with-sql-connection (conn)
(sql-drop-tables conn)
(translate-all-files extension)
(with-sql-connection (conn)
(sql-drop-tables conn)
@@
-190,7
+192,8
@@
This is much faster that using create-umls-db-insert."
(defun translate-all-files (&optional (extension ".trans"))
"Copy translated files and return postgresql copy commands to import"
(make-noneng-index-file extension)
(defun translate-all-files (&optional (extension ".trans"))
"Copy translated files and return postgresql copy commands to import"
(make-noneng-index-file extension)
- (dolist (f *umls-files*) (translate-umls-file f extension)))
+ (dolist (f (remove-if "MRXW.NONENG" *umls-files* :test #'string= :key #'fil))
+ (translate-umls-file f extension)))
(defun translate-umls-file (file extension)
"Translate a umls file into a format suitable for sql copy cmd"
(defun translate-umls-file (file extension)
"Translate a umls file into a format suitable for sql copy cmd"
@@
-274,7
+277,7
@@
This is much faster that using create-umls-db-insert."
(nreverse avoidable) (nreverse unavoidable))))
(defun display-waste ()
(nreverse avoidable) (nreverse unavoidable))))
(defun display-waste ()
- (ensure-
init-uml
s)
+ (ensure-
ucols+ufile
s)
(multiple-value-bind (tw ta tu al ul) (umls-fixed-size-waste)
(format t "Total waste: ~d~%" tw)
(format t "Total avoidable: ~d~%" ta)
(multiple-value-bind (tw ta tu al ul) (umls-fixed-size-waste)
(format t "Total waste: ~d~%" tw)
(format t "Total avoidable: ~d~%" ta)
@@
-290,7
+293,7
@@
This is much faster that using create-umls-db-insert."
(defun max-umls-field ()
"Return length of longest field"
(declare (optimize (speed 3) (space 0)))
(defun max-umls-field ()
"Return length of longest field"
(declare (optimize (speed 3) (space 0)))
- (ensure-
init-uml
s)
+ (ensure-
ucols+ufile
s)
(let ((max 0))
(declare (fixnum max))
(dolist (ucol *umls-cols*)
(let ((max 0))
(declare (fixnum max))
(dolist (ucol *umls-cols*)
@@
-301,7
+304,7
@@
This is much faster that using create-umls-db-insert."
(defun max-umls-row ()
"Return length of longest row"
(declare (optimize (speed 3) (space 0)))
(defun max-umls-row ()
"Return length of longest row"
(declare (optimize (speed 3) (space 0)))
- (ensure-
init-uml
s)
+ (ensure-
ucols+ufile
s)
(let ((rowsizes '()))
(dolist (file *umls-files*)
(let ((row 0))
(let ((rowsizes '()))
(dolist (file *umls-files*)
(let ((row 0))