r9096: quote numbers so that postgresql will index on bigint
authorKevin M. Rosenberg <kevin@rosenberg.net>
Mon, 19 Apr 2004 12:38:32 +0000 (12:38 +0000)
committerKevin M. Rosenberg <kevin@rosenberg.net>
Mon, 19 Apr 2004 12:38:32 +0000 (12:38 +0000)
package.lisp
sql-classes.lisp

index cbe8a5d8ea78a2faec7879f1c1308d26c1e9e5bd..47c249af8067b177967815359bc1bb7418e9e0b7 100644 (file)
@@ -59,6 +59,7 @@
    #:umls-sql-passwd!
    #:umls-sql-db!
    #:umls-sql-host!
+   #:umls-sql-type!
    #:with-sql-connection
    #:mutex-sql-execute
    #:mutex-sql-query
index 48e7d54a538e66bea2290c61e8d4ae76037bbd92..3611654bf62e840ce5f37f1c0572ed9a630c3ec4 100644 (file)
@@ -43,9 +43,9 @@
       ,@(when %%where
              `((typecase ,where-value
                  (fixnum
-                  (prefixed-fixnum-string ,where-value #\= 10))
+                  (concatenate 'string "='" (prefixed-fixnum-string ,where-value #\0 10) "'"))
                  (number
-                  (concatenate 'string "=" (write-to-string ,where-value)))
+                  (concatenate 'string "='" (write-to-string ,where-value) "'"))
                  (null
                   " is null")
                  (t
@@ -332,7 +332,7 @@ is OBJNAME from TABLE where WHERE-NAME field = WHERE-VALUE with FIELDS"
   (collect-umlisp-query (mrcoc (cui2 soc cot cof coa kpfstr2) srl cui1
                            cui :lrl klrl :order (cof asc))
     (setq cui2 (ensure-integer cui2))
-    (when (zerop cui2) (setq cui2 nil))
+    (when (eql 0 cui2) (setq cui2 nil))
     (make-instance 'ucoc :cui1 cui :cui2 (ensure-integer cui2)
                   :soc soc :cot cot :cof (ensure-integer cof) :coa coa
                   :pfstr2 kpfstr2)))
@@ -479,13 +479,14 @@ is OBJNAME from TABLE where WHERE-NAME field = WHERE-VALUE with FIELDS"
   (ensure-sui-integer sui)
   (let ((ls "select CODE,ATN,SAB,ATV from MRSAT where "))
     (cond
-      (sui (string-append ls "KCUISUI="
-                         (integer-string (make-cuisui cui sui) 14)))
-      (lui (string-append ls "KCUILUI="
+      (sui (string-append ls "KCUISUI='"
+                         (integer-string (make-cuisui cui sui) 14)
+                         "'"))
+      (lui (string-append ls "KCUILUI='"
                          (integer-string (make-cuilui cui lui) 14)
-                         " and sui=0"))
-      (t (string-append ls "cui=" (prefixed-fixnum-string cui nil 7)
-                       " and lui=0 and sui=0")))
+                         "' and sui='0'"))
+      (t (string-append ls "cui='" (prefixed-fixnum-string cui nil 7)
+                       "' and lui='0' and sui='0'")))
     (when srl
       (string-append ls " and KSRL<=" (prefixed-fixnum-string srl nil 3)))
     (loop for tuple in (mutex-sql-query ls) collect