X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=sql-classes.lisp;h=a407364012b868e02371b61856717e7e7c2a2f07;hb=cdaa9cb65482eaca5a8eafbbe7b3bec9fb157512;hp=66e2cbbb2d47ed01efba94ce341f73c34dc932b1;hpb=041283a294efc5303c1632b57536e0823c9f8bee;p=umlisp.git diff --git a/sql-classes.lisp b/sql-classes.lisp index 66e2cbb..a407364 100644 --- a/sql-classes.lisp +++ b/sql-classes.lisp @@ -65,7 +65,7 @@ ,@(when %%order (list %%order)) (cond ((and ,%single ,%limit) - (error "Can't set single and limit")) + (error "Can't set single (~S) and limit (~S)" ,%single ,%limit)) (,%single " LIMIT 1") (,%limit @@ -744,17 +744,17 @@ is OBJNAME from TABLE where WHERE-NAME field = WHERE-VALUE with FIELDS" (let ((query (format nil "SELECT c.cui FROM MRCONSO c,MRXW_ENG x WHERE x.WD ~A '~A' AND x.cui=c.cui AND ~A ~A" (if like "LIKE" "=") (clsql-sys::sql-escape-quotes word) - (typecase sab + (etypecase sab (string - (format nil " c.sab='" (clsql-sys::sql-escape-quotes sab))) + (format nil " c.sab='~A'" (clsql-sys::sql-escape-quotes sab))) (cons - (format nil " c.sab IN (~('~A'~^,~))" + (format nil " c.sab IN (~{'~A'~^,~})" (mapcar 'clsql-sys::sql-escape-quotes sab))) - (t + (null (error "SAB missing"))) (if srl (format nil "AND KCUILRL <= ~A" srl) "")))) (loop for tuple in (mutex-sql-query query) - collect (make-instance 'ucon (first tuple))))) + collect (make-instance 'ucon :cui (first tuple))))) (defun find-ustr-word-sab (word &key sab (srl *current-srl*) (like nil)) "Return list of ustr that match word in matching SAB. Optionally, use SQL's LIKE syntax" @@ -1092,25 +1092,3 @@ is OBJNAME from TABLE where WHERE-NAME field = WHERE-VALUE with FIELDS" (collect-umlisp-query (ustats (name count) nil srl srl :order (name asc)) (make-instance 'ustats :name name :hits (ensure-integer count)))) - - -(defun find-bsab-sab (sab) - (collect-umlisp-query (bonus_sab (name count) nil sab sab :single t) - (make-instance 'bsab :sab sab :name name :hits (ensure-integer count)))) - -(defun find-bsab-all () - (collect-umlisp-query (bonus_sab (sab name count) nil nil nil :order (sab asc)) - (make-instance 'bsab :sab sab :name name :hits (ensure-integer count)))) - -(defun find-btty-tty (tty) - (collect-umlisp-query (bonus_tty (name count) nil tty tty :single t) - (make-instance 'btty :tty tty :name name :hits (ensure-integer count)))) - -(defun find-btty-all () - (collect-umlisp-query (bonus_tty (tty name count) nil nil nil :order (tty asc)) - (make-instance 'btty :tty tty :name name :hits (ensure-integer count)))) - -(defun find-brel-rel (rel) - (collect-umlisp-query (bonus_rel (sab sl rel rela count) nil rel rel) - (make-instance 'brel :sab sab :sl sl :rel rel :rela rela - :hits (ensure-integer count))))