From: Russ Tyndall Date: Fri, 9 Oct 2009 20:32:34 +0000 (-0400) Subject: made select accept a parameters argument. If parameters are supplied, it builds X-Git-Url: http://git.kpe.io/?p=clsql.git;a=commitdiff_plain;h=8b4602546d876db6e9853635d694de1993214127;hp=d704ea35ebc38b6b9efd5cbb0417d0340bee3c5c made select accept a parameters argument. If parameters are supplied, it builds a command object and executes that instead of the flat query. This allows you to return objects and use parameters --- diff --git a/sql/oodml.lisp b/sql/oodml.lisp index 9aff2c8..069275c 100644 --- a/sql/oodml.lisp +++ b/sql/oodml.lisp @@ -884,7 +884,7 @@ maximum of MAX-LEN instances updated in each query." order-by offset limit refresh flatp result-types inner-join on (database *default-database*) - instances) + instances parameters) "Called by SELECT to generate object query results when the View Classes VIEW-CLASSES are passed as arguments to SELECT." (declare (ignore all set-operation group-by having offset limit inner-join on)) @@ -1112,6 +1112,7 @@ as elements of a list." results)))))))) (t (let* ((expr (apply #'make-query select-all-args)) + (parameters (second (member :parameters select-all-args))) (specified-types (mapcar #'(lambda (attrib) (if (typep attrib 'sql-ident-attribute) @@ -1121,12 +1122,17 @@ as elements of a list." t)) t)) (slot-value expr 'selections)))) + (destructuring-bind (&key (flatp nil) - (result-types :auto) - (field-names t) - (database *default-database*) - &allow-other-keys) + (result-types :auto) + (field-names t) + (database *default-database*) + &allow-other-keys) qualifier-args + (when parameters + (setf expr (make-instance 'command-object + :expression (sql-output expr database) + :parameters parameters))) (query expr :flatp flatp :result-types ;; specifying a type for an attribute overrides result-types