made select accept a parameters argument.
authorRuss Tyndall <russ@acceleration.net>
Wed, 8 Jun 2011 21:12:57 +0000 (17:12 -0400)
committerNathan Bird <nathan@acceleration.net>
Thu, 30 Jun 2011 20:56:28 +0000 (16:56 -0400)
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

  prev: 8b4602546d876db6e9853635d694de1993214127

sql/oodml.lisp

index fced9aad186871523aa8a309a3dc5cf3ef612cbc..99cf0217f31f7c8325a4cc890ae3d0df34606d51 100644 (file)
@@ -1086,7 +1086,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))
@@ -1313,6 +1313,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)
@@ -1328,6 +1329,8 @@ as elements of a list."
                                      (database *default-database*)
                                      &allow-other-keys)
                qualifier-args
+             (when parameters
+               (setf expr (command-object (sql-output expr database) parameters)))
              (query expr :flatp flatp
                     :result-types
                     ;; specifying a type for an attribute overrides result-types