r11164: fix case in tests
[umlisp.git] / sql-classes.lisp
index 594103fcd95c0d9a7b3303f5119b1f3512854136..f6f306ecb204ce8162f92bcf39b9dad8d01a5d3c 100644 (file)
@@ -35,7 +35,7 @@
                      ""))
         (%%lrl (format nil " AND ~:@(~A~)<=" lrl))
         (%%where (when where-name
-                   (format nil " where ~:@(~A~)~A" where-name
+                   (format nil " WHERE ~:@(~A~)~A" where-name
                          (if like " like " ""))))
          (%filter (gensym "FILTER-"))
          (%single (gensym "SINGLE-"))
@@ -55,7 +55,7 @@
                 (number
                  (concatenate 'string "='" (write-to-string ,where-value) "'"))
                 (null
-                 " is null")
+                 " IS NULL")
                 (t
                  (format nil ,(if like "'%~A%'" "='~A'") ,where-value)))))
         (if ,%filter (concatenate 'string
   (when single (setq limit 1))
   (concatenate
    'string
-   (format nil "select ~A~{~:@(~A~)~^,~} from ~:@(~A~)"
-          (if distinct "distinct " "") fields table)
-   (if where-name (format nil " where ~:@(~A~)" where-name) "")
+   (format nil "SELECT ~A~{~:@(~A~)~^,~} FROM ~:@(~A~)"
+          (if distinct "DISTINCT " "") fields table)
+   (if where-name (format nil " WHERE ~:@(~A~)" where-name) "")
    (if where-name
        (format nil
               (typecase where-value
                 (number "='~D'")
-                (null " is null")
+                (null " IS NULL")
                 (t
-                 (if like " like '%~A%""='~A'")))
+                 (if like " LINK '%~A%""='~A'")))
               where-value)
        "")
    (if filter (concatenate 'string " AND " filter) nil)
-   (if srl (format nil " and ~:@(~A~)<=~D" lrl srl) "")
-   (if order (format nil " order by ~{~:@(~A~) ~(~A~)~^,~}" order) "")
-   (if limit (format nil " limit ~D" limit) "")))
+   (if srl (format nil " AND ~:@(~A~)<=~D" lrl srl) "")
+   (if order (format nil " ORDER BY ~{~:@(~A~) ~(~A~)~^,~}" order) "")
+   (if limit (format nil " LIMIT ~D" limit) "")))
 
 
 (defmacro umlisp-query (table fields srl where-name where-value
@@ -604,7 +604,7 @@ is OBJNAME from TABLE where WHERE-NAME field = WHERE-VALUE with FIELDS"
   (ensure-cui-integer cui)
   (ensure-lui-integer lui)
   (ensure-sui-integer sui)
-  (let ((ls "select CODE,ATN,SAB,ATV from MRSAT where "))
+  (let ((ls "SELECT CODE,ATN,SAB,ATV FROM MRSAT WHERE "))
     (cond
       (sui (string-append ls "KCUISUI='"
                          (integer-string (make-cuisui cui sui) 14)