+(defmacro with-umlisp-query ((table fields srl where-name where-value
+ &key (lrlname "KCUILRL") distinct single
+ order like)
+ &body body)
+ (if single
+ `(unless (and ,where-name (not ,where-value))
+ (let ((tuple (car (umlisp-query ,table ,fields ,srl ,where-name ,where-value
+ :lrlname ,lrlname :single ,single
+ :distinct ,distinct :order ,order :like ,like))))
+ (when tuple
+ (destructuring-bind ,fields tuple
+ ,@body))))
+ `(unless (and ,where-name (not ,where-value))
+ (loop for tuple in
+ (umlisp-query ,table ,fields ,srl ,where-name ,where-value
+ :lrlname ,lrlname :single ,single :distinct ,distinct :order ,order :like ,like)
+ collect (destructuring-bind ,fields tuple
+ ,@body)))))
+
+(defmacro umlisp-query (table fields srl where-name where-value
+ &key (lrlname "KCUILRL") single distinct order like)
+ "Query the UMLisp database. Return a list of umlisp objects whose name
+is OBJNAME from TABLE where WHERE-NAME field = WHERE-VALUE with FIELDS"
+ `(when (or (not ,where-name) ,where-value)
+ (mutex-sql-query
+ (query-string-macro ,table ,fields ,srl ,where-name ,where-value
+ :lrlname ,lrlname :single ,single :distinct ,distinct :order ,order :like ,like))))