X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=sql-classes.lisp;h=92539c816662eb7edc817f8106c3c57fea281c4d;hb=ea8e5d301c92b5038bec6b943e1e4b542f272661;hp=088aec8fb9b07ce2c2567a6130115e0b515eb6b5;hpb=db063417a5e61323e4fcb3429c928a7ba252ab9d;p=umlisp.git diff --git a/sql-classes.lisp b/sql-classes.lisp index 088aec8..92539c8 100644 --- a/sql-classes.lisp +++ b/sql-classes.lisp @@ -7,7 +7,7 @@ ;;;; Author: Kevin M. Rosenberg ;;;; Date Started: Apr 2000 ;;;; -;;;; $Id: sql-classes.lisp,v 1.58 2003/05/04 00:30:36 kevin Exp $ +;;;; $Id: sql-classes.lisp,v 1.59 2003/05/04 00:45:35 kevin Exp $ ;;;; ;;;; This file, part of UMLisp, is ;;;; Copyright (c) 2000-2002 by Kevin M. Rosenberg, M.D. @@ -82,19 +82,19 @@ "Query the UMLisp database. Return a list of umlisp objects whose name is OBJNAME from TABLE where WHERE-NAME field = WHERE-VALUE with FIELDS" `(mutex-sql-query - (query-string-macro ,table ,fields ,srl ,where-name ,where-value + (query-string ,table ,fields ,srl ,where-name ,where-value :lrl ,lrl :single ,single :distinct ,distinct :order ,order :like ,like))) -(defun umlisp-query-eval (table fields srl where-name where-value +(defmacro umlisp-query-eval (table fields srl where-name where-value &key (lrl "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" - (mutex-sql-query - (query-string-macro ,table ,fields ,srl ,where-name ,where-value + `(mutex-sql-query + (query-string-eval ,table ,fields ,srl ,where-name ,where-value :lrl ,lrl :single ,single :distinct ,distinct :order ,order :like ,like))) -(defmacro query-string-macro (table fields &optional srl where-name where-value +(defmacro query-string (table fields &optional srl where-name where-value &key (lrl "KCUILRL") single distinct order like) (let* ((%%fields (format nil "select ~A~{~:@(~A~)~^,~} from ~:@(~A~)" (if distinct "distinct " "") fields table)) @@ -115,8 +115,8 @@ is OBJNAME from TABLE where WHERE-NAME field = WHERE-VALUE with FIELDS" ,@(when %%order (list %%order)) ,@(when single (list " limit 1"))))) -(defun query-string (table fields &optional srl where-name where-value - &key (lrl "KCUILRL") single distinct order like) +(defun query-string-eval (table fields &optional srl where-name where-value + &key (lrl "KCUILRL") single distinct order like) (concatenate 'string (format nil "select ~A~{~:@(~A~)~^,~} from ~:@(~A~)"