X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=sql%2Foodml.lisp;h=99cf0217f31f7c8325a4cc890ae3d0df34606d51;hb=0bed331173815bfe0544c0fdad6fb8b83ae929f1;hp=ec54a346aa8db48b3d1b500fd3e0ec79b168738b;hpb=7b4794147500df7188fef2fe4f5e16d05d552ffd;p=clsql.git diff --git a/sql/oodml.lisp b/sql/oodml.lisp index ec54a34..99cf021 100644 --- a/sql/oodml.lisp +++ b/sql/oodml.lisp @@ -1075,21 +1075,24 @@ maximum of MAX-LEN instances updated in each query." (car objects) objects)))) +(defmethod select-table-sql-expr ((table T)) + "Turns an object representing a table into the :from part of the sql expression that will be executed " + (sql-expression :table (view-table table))) + + (defun find-all (view-classes &rest args &key all set-operation distinct from where group-by having 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)) (flet ((ref-equal (ref1 ref2) (string= (sql-output ref1 database) (sql-output ref2 database))) - (table-sql-expr (table) - (sql-expression :table (view-table table))) (tables-equal (table-a table-b) (when (and table-a table-b) (string= (string (slot-value table-a 'name)) @@ -1116,10 +1119,10 @@ maximum of MAX-LEN instances updated in each query." (sel-tables (collect-table-refs where)) (tables (remove-if #'null (remove-duplicates - (append (mapcar #'table-sql-expr sclasses) + (append (mapcar #'select-table-sql-expr sclasses) (mapcan #'(lambda (jc-list) (mapcar - #'(lambda (jc) (when jc (table-sql-expr jc))) + #'(lambda (jc) (when jc (select-table-sql-expr jc))) jc-list)) immediate-join-classes) sel-tables) @@ -1310,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) @@ -1325,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