From: Kevin M. Rosenberg Date: Fri, 14 May 2004 20:25:00 +0000 (+0000) Subject: r9357: initial update-object-joins X-Git-Tag: v3.8.6~460 X-Git-Url: http://git.kpe.io/?p=clsql.git;a=commitdiff_plain;h=8373c592f525a394a1ff66986ad4acf50e8e11b7 r9357: initial update-object-joins --- diff --git a/ChangeLog b/ChangeLog index d8580ef..42f5b29 100644 --- a/ChangeLog +++ b/ChangeLog @@ -25,7 +25,8 @@ * db-mysql/mysql-api.lisp: Fix int vs. long slots in foreign structures found by testing with AllegroCL 7.0b AMD64. * db-*/*-loader.lisp: Load 64-bit libraries on 64-bit platorms - * sql/objects.lisp: Initial caching support for SELECT + * sql/objects.lisp: Simple implementation of UPDATE-OBJECT-JOINS. + Initial caching support for SELECT * tests/test-oodml.lisp: Avoid using cache when testing select. * sql/kmr-mop.lisp: Explicitly check slot order and store as a cl:*feature* diff --git a/TODO b/TODO index 0beae4c..8563e0a 100644 --- a/TODO +++ b/TODO @@ -12,10 +12,6 @@ TESTS TO ADD COMMONSQL SPEC -* Missing: - - UPDATE-OBJECT-JOINS - * Incompatible >> The functional sql interface @@ -34,8 +30,16 @@ COMMONSQL SPEC o variables (e.g., table identifiers) should be instantiated at runtime -OPTIMIZATIONS +VARIANCES FROM COMMONSQL + +UPDATE-OBJECT-JOINS: + Rather than simply reading the values for each + object, to meet CommonSQL spec need to generate a single + query to read values for all objects, up to max-len count. + +OPTIMIZATIONS + * Revisit result-type list creation,perhaps caching POSSIBLE EXTENSIONS diff --git a/sql/objects.lisp b/sql/objects.lisp index ce6022c..523ff61 100644 --- a/sql/objects.lisp +++ b/sql/objects.lisp @@ -806,15 +806,28 @@ superclass of the newly-defined View Class." (defun update-object-joins (objects &key (slots t) (force-p t) class-name (max-len *default-update-objects-max-len*)) - "Updates the remote join slots, that is those slots defined without :retrieval :immediate." + "Updates the remote join slots, that is those slots defined without +:retrieval :immediate." (when objects (unless class-name - (class-name (class-of (first objects)))) + (setq class-name (class-name (class-of (first objects))))) (let* ((class (find-class class-name)) (deferred-joins (generate-retrieval-joins-list class :deferred))) - (when deferred-joins - (warn "not yet implemented.") - )))) + (cond + (deferred-joins + (mapcar + #'(lambda (slotdef) + ;; FIXME: Rather than simply reading the values for each + ;; object, to meet CommonSQL spec need to generate a single + ;; query to read values for all objects, up to max-len count + (mapcar + #'(lambda (object) + (slot-value object (slot-definition-name slotdef))) + objects)) + deferred-joins)) + (t + (warn "Class ~A does not have any deferred join slots." class-name))) + ))) (defun fault-join-slot-raw (class object slot-def)