From fdc28505b82da26cc8142964cb8ae40cdc8bfdfc Mon Sep 17 00:00:00 2001 From: Russ Tyndall Date: Thu, 3 Sep 2009 17:34:38 -0400 Subject: [PATCH] Pulled a flet out into a method (select-table-sql-expr) which can be overridden to supply a different implementation. The impetus for this is that I wanted to select from a function's results aliased as the table instead of the table directly. prev: 53bf64089da7f091d748f46eb95ebeb39d990dd9 --- sql/oodml.lisp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/sql/oodml.lisp b/sql/oodml.lisp index ec54a34..fced9aa 100644 --- a/sql/oodml.lisp +++ b/sql/oodml.lisp @@ -1075,6 +1075,11 @@ 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 @@ -1088,8 +1093,6 @@ maximum of MAX-LEN instances updated in each query." (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) -- 2.34.1