Fix LIKE SQL syntax
authorKevin M. Rosenberg <kevin@rosenberg.net>
Sun, 28 Feb 2010 01:40:12 +0000 (18:40 -0700)
committerKevin M. Rosenberg <kevin@rosenberg.net>
Sun, 28 Feb 2010 01:40:12 +0000 (18:40 -0700)
package.lisp
sql-classes.lisp

index 66ca559ef482d9fd3aeea7b3b9be4dc16919244b..9572374711612eea24e5584d82feeb1b070e3ed9 100644 (file)
@@ -30,6 +30,7 @@
          #:lexterm #:labr #:lagr #:lcmp #:lmod #:lnom #:lprn #:lprp #:lspl #:ltrm
          #:ltyp #:lwd #:sdef #:sstr #:sstre1 #:sstre2
          #:sty #:tui #:def #:sab #:srl #:tty #:rank #:suppress #:atn #:atv #:vcui
+         #:rmeta #:imeta #:scit #:scc #:slc
          #:rcui #:vsab #:code #:saui #:scui #:sdui #:ispref
          #:rl #:sty2 #:ui #:ui2 #:ui3 #:eui #:bas #:eui2 #:bas2 #:rui
          #:cui #:aui #:lui #:sui #:wd #:lat #:nstr :cuilist
index cd676f1e5d53a4b595e89a0cecdcfb0b73b07356..9722be4f830a388f4bb93f694f9412cf07d4bfe0 100644 (file)
@@ -85,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)
@@ -602,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)
@@ -691,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
@@ -707,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))