projects
/
umlisp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Changes needed for 2009AB version of UMLS
[umlisp.git]
/
sql.lisp
diff --git
a/sql.lisp
b/sql.lisp
index 83f38e97164311bea10885f4f95866bfc18800d9..207d68c6fa86ef933298fc2576ce6b35e26fb698 100644
(file)
--- a/
sql.lisp
+++ b/
sql.lisp
@@
-7,10
+7,8
@@
;;;; Author: Kevin M. Rosenberg
;;;; Created: Apr 2000
;;;;
;;;; Author: Kevin M. Rosenberg
;;;; Created: Apr 2000
;;;;
-;;;; $Id$
-;;;;
;;;; This file, part of UMLisp, is
;;;; This file, part of UMLisp, is
-;;;; Copyright (c) 2000-20
06
by Kevin M. Rosenberg, M.D.
+;;;; Copyright (c) 2000-20
10
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.
;;;;
;;;; UMLisp users are granted the rights to distribute and use this software
;;;; as governed by the terms of the GNU General Public License.
@@
-20,9
+18,10
@@
(defvar +umls-sql-map+
'((:2004aa . "KUMLS2004AA")
(defvar +umls-sql-map+
'((:2004aa . "KUMLS2004AA")
- (:2006ac . "KUMLS2006AC")))
-(defvar +default-umls-db+ :2006ac)
-
+ (:2006ac . "KUMLS2006AC")
+ (:2006ad . "MTS2006AD")
+ (:2009ab . "MTS2009AB")))
+(defvar +default-umls-db+ "MTS2009AB")
(defun lookup-db-name (db)
(cdr (assoc (ensure-keyword db) +umls-sql-map+)))
(defun lookup-db-name (db)
(cdr (assoc (ensure-keyword db) +umls-sql-map+)))
@@
-67,13
+66,17
@@
(setq *umls-sql-type* h))
(defun umls-connection-spec ()
(setq *umls-sql-type* h))
(defun umls-connection-spec ()
- (list *umls-sql-host* *umls-sql-db*
- *umls-sql-user* *umls-sql-passwd*))
+ (if (eql *umls-sql-type* :mysql)
+ (list *umls-sql-host* *umls-sql-db*
+ *umls-sql-user* *umls-sql-passwd*
+ nil '((:local-infile . 1)))
+ (list *umls-sql-host* *umls-sql-db*
+ *umls-sql-user* *umls-sql-passwd*)))
(defun sql-connect ()
"Connect to UMLS database, automatically used pooled connections"
(clsql:connect (umls-connection-spec)
(defun sql-connect ()
"Connect to UMLS database, automatically used pooled connections"
(clsql:connect (umls-connection-spec)
- :database-type *umls-sql-type* :pool t))
+
:database-type *umls-sql-type* :pool t))
(defun sql-disconnect (conn)
"Disconnect from UMLS database, but put connection back into pool"
(defun sql-disconnect (conn)
"Disconnect from UMLS database, but put connection back into pool"
@@
-85,7
+88,7
@@
(defmacro with-sql-connection ((conn) &body body)
`(let ((,conn (sql-connect)))
(unwind-protect
(defmacro with-sql-connection ((conn) &body body)
`(let ((,conn (sql-connect)))
(unwind-protect
- (progn ,@body)
+
(progn ,@body)
(when ,conn (clsql:disconnect :database ,conn)))))
(defun sql-query (cmd conn &key (result-types :auto))
(when ,conn (clsql:disconnect :database ,conn)))))
(defun sql-query (cmd conn &key (result-types :auto))
@@
-109,7
+112,7
@@
(defmacro with-mutex-sql ((conn) &body body)
`(let ((,conn (sql-connect)))
(unwind-protect
(defmacro with-mutex-sql ((conn) &body body)
`(let ((,conn (sql-connect)))
(unwind-protect
- (progn ,@body)
+
(progn ,@body)
(when ,conn (sql-disconnect ,conn)))))
(defun mutex-sql-execute (cmd)
(when ,conn (sql-disconnect ,conn)))))
(defun mutex-sql-execute (cmd)