Add missing ts field
[umlisp.git] / sql-classes.lisp
index ae14b38c892faf2ce85ba4c3590b22fd306de9ca..9722be4f830a388f4bb93f694f9412cf07d4bfe0 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.
@@ -22,7 +20,7 @@
 (defvar *current-srl* nil)
 (defun current-srl ()
   *current-srl*)
-(defun current-srl! (srl)
+(defun set-current-srl (srl)
   (setq *current-srl* srl))
 
 (defmacro query-string (table fields srl where-name where-value
@@ -87,7 +85,7 @@
                  (number "='~D'")
                  (null " IS NULL")
                  (t
-                  (if like " LINK '%~A%""='~A'")))
+                  (if like " LIKE '%~A%'" "='~A'")))
                where-value)
        "")
    (if filter (concatenate 'string " AND " filter) nil)
@@ -604,11 +602,11 @@ is OBJNAME from TABLE where WHERE-NAME field = WHERE-VALUE with FIELDS"
 (defun find-uso-cuisui (cui sui &key (srl *current-srl*))
   (ensure-sui-integer sui)
   (ensure-cui-integer cui)
-  (collect-umlisp-query (mrconso (aui sab code srl tty saui sdui scui lat str)
+  (collect-umlisp-query (mrconso (aui sab code srl tty saui sdui scui lat str ts)
                                  srl kcuisui (make-cuisui cui sui) :lrl srl)
     (make-instance 'uso :aui aui :sab sab :code code :srl srl :tty tty
                    :cui cui :sui sui :saui saui :sdui sdui :scui scui
-                   :lat lat :str str)))
+                   :lat lat :str str :ts ts)))
 
 (defun find-uso-cui (cui &key (srl *current-srl*) (english-only nil) limit)
   (ensure-cui-integer cui)
@@ -693,13 +691,14 @@ is OBJNAME from TABLE where WHERE-NAME field = WHERE-VALUE with FIELDS"
                    :cxty cxty :ttyl ttyl :atnl atnl :lat lat :cenc cenc
                    :curver curver :sabin sabin :ssn ssn :scit scit)))
 
-(defun find-usab-by-key (key-name key)
+(defun find-usab-by-key (key-name key &key current)
   "Find usab for a key"
   (collect-umlisp-query-eval ('mrsab '(vcui rcui vsab rsab son sf sver vstart
                                        vend imeta rmeta slc scc srl tfr cfr cxty
                                        ttyl atnl lat cenc curver sabin
                                        ssn scit)
-                                     nil key-name key :single t)
+                                     nil key-name key :single t
+                                     :filter (when current "RMETA=''"))
      (make-instance 'usab :vcui (ensure-integer vcui)
                     :rcui (ensure-integer rcui) :vsab vsab :rsab rsab :son son
                     :sf sf :sver sver :vstart vstart :vend vend :imeta imeta
@@ -709,11 +708,11 @@ is OBJNAME from TABLE where WHERE-NAME field = WHERE-VALUE with FIELDS"
                     :curver curver :sabin sabin
                     :ssn ssn :scit scit)))
 
-(defun find-usab-rsab (rsab)
+(defun find-usab-rsab (rsab &key (current t))
   "Find usab for rsab"
   (find-usab-by-key 'rsab rsab))
 
-(defun find-usab-vsab (vsab)
+(defun find-usab-vsab (vsab &key (current t))
   "Find usab for vsab"
   (find-usab-by-key 'vsab vsab))