From 8b4602546d876db6e9853635d694de1993214127 Mon Sep 17 00:00:00 2001 From: Russ Tyndall Date: Fri, 9 Oct 2009 16:32:34 -0400 Subject: [PATCH] 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 --- sql/oodml.lisp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) 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 -- 2.34.1