r4845: *** empty log message ***
[umlisp.git] / sql-classes.lisp
index 6e62db214a273c52f4837b2f74e240b971f78aec..f76ebffd52330f6c9c373a30999446c72aae68e6 100644 (file)
@@ -7,7 +7,7 @@
 ;;;; Author:        Kevin M. Rosenberg
 ;;;; Date Started:  Apr 2000
 ;;;;
-;;;; $Id: sql-classes.lisp,v 1.71 2003/05/06 01:34:57 kevin Exp $
+;;;; $Id: sql-classes.lisp,v 1.73 2003/05/06 09:05:43 kevin Exp $
 ;;;;
 ;;;; This file, part of UMLisp, is
 ;;;;    Copyright (c) 2000-2002 by Kevin M. Rosenberg, M.D.
    'string
    (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 " where ~A=~D")
-                (null " where ~A is null")
+                (number "=~D")
+                (null " is null")
                 (t
-                 (if like
-                     " where ~A like '%~A%'"
-                     " where ~A='~A'")))
-              where-name where-value)
+                 (if like " like '%~A%""='~A'")))
+              where-value)
        "")
    (if srl (format nil " and ~:@(~A~)<=~D" lrl srl) "")
    (if order (format nil " order by ~{~:@(~A~) ~(~A~)~^,~}" order) "")
@@ -506,6 +505,18 @@ is OBJNAME from TABLE where WHERE-NAME field = WHERE-VALUE with FIELDS"
                                 :order (cui asc sui asc))
     (find-ustr-cuisui (ensure-integer cui) (ensure-integer sui) :srl srl)))
 
+(defun find-ucon-noneng-word (word &key (srl *current-srl*) (like nil))
+  "Return list of ucons that match non-english word"
+  (with-umlisp-query-eval ('mrxw_noneng '(cui) srl 'wd word :like like
+                                       :distinct t :lrl 'klrl :order '(cui asc))
+    (find-ucon-cui cui :srl srl)))
+
+(defun find-ustr-noneng-word (word &key (srl *current-srl*))
+  "Return list of ustrs that match non-english word"
+  (with-umlisp-query (mrxw_noneng (cui sui) srl wd word :lrl klrl
+                                 :order (cui asc sui asc))
+    (find-ustr-cuisui (ensure-integer cui) (ensure-integer sui) :srl srl)))
+
 ;; Special tables
 
 (defun find-usrl-all ()