Commit 3a773f9a authored by ryszard.szopa's avatar ryszard.szopa
Browse files

remove-finished-classes, called before and after applying constraints.

parent d31b57f6
......@@ -102,19 +102,24 @@ metaclass set to DB-CLASS."
(when (unique slot)
(push slot (db-class-unique-keys class)))))
(defgeneric remove-finished-classes (class)
(:documentation "Remove classes that are already finished from UNFINISHED-CLASSES of CLASS.")
(:method ((class db-class))
(setf (db-class-unfinished-classes class)
(delete-if (lambda (x) (notany #'delayed-constraint (class-slots x))) (db-class-unfinished-classes class)))))
(defgeneric try-delayed-constraints (class)
(:documentation "Try to call all the delayed constraints present.")
(:method ((class db-class))
;remove classes that are not dirty anymore:
(setf (db-class-unfinished-classes class)
(delete-if (lambda (x) (notany #'delayed-constraint (class-slots x))) (db-class-unfinished-classes class)))
(remove-finished-classes class)
(iter (for dirty-class in (db-class-unfinished-classes class))
(iter (for slot in (class-slots dirty-class))
(when (delayed-constraint slot)
(handler-case (progn (funcall (delayed-constraint slot))
(setf (delayed-constraint slot) nil))
(database-error ()
(remove-finished-classes class)))
;;; Copyright (C) 2007
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment