X-Git-Url: http://git.kpe.io/?p=clsql.git;a=blobdiff_plain;f=sql%2Fmetaclasses.lisp;h=1c9a6c5b34583fe882886bdb6c65b7ce70f665cd;hp=1fde1eef9f2319b7045396d3d113b0f51bf1a17a;hb=142fb42d3502f82883f7a49c9b0587bfc3de57b1;hpb=39e2802cd264ddacb3ca59b3b2c5c38f202149de diff --git a/sql/metaclasses.lisp b/sql/metaclasses.lisp index 1fde1ee..1c9a6c5 100644 --- a/sql/metaclasses.lisp +++ b/sql/metaclasses.lisp @@ -542,9 +542,7 @@ implementations." (defun slotdef-for-slot-with-class (slot class) (typecase slot (standard-slot-definition slot) - (symbol - (find-if #'(lambda (d) (eql slot (slot-definition-name d))) - (class-slots class))))) + (symbol (find-slot-by-name class slot)))) #+ignore (eval-when (:compile-toplevel :load-toplevel :execute) @@ -578,18 +576,40 @@ implementations." cls)) (defun slots-for-possibly-normalized-class (class) + "Get the slots for this class, if normalized this is only the direct slots + otherwiese its all the slots" (if (normalizedp class) (ordered-class-direct-slots class) (ordered-class-slots class))) + (defun key-slot-p (slot-def) "takes a slot def and returns whether or not it is a key" (eql :key (view-class-slot-db-kind slot-def))) (defun join-slot-p (slot-def) - "takes a slot def and returns whether or not it is a key" + "takes a slot def and returns whether or not it is a join slot" (eql :join (view-class-slot-db-kind slot-def))) +(defun join-slot-info-value (slot-def key) + "Get the join-slot db-info value associated with a key" + (when (join-slot-p slot-def) + (let ((dbi (view-class-slot-db-info slot-def))) + (when dbi (gethash key dbi))))) + +(defun join-slot-retrieval-method (slot-def) + "if this is a join slot return the retrieval param in the db-info" + (join-slot-info-value slot-def :retrieval)) + +(defun join-slot-class-name (slot-def) + "get the join class name for a given join slot" + (join-slot-info-value slot-def :join-class)) + +(defun join-slot-class (slot-def) + "Get the join class for a given join slot" + (let ((c (join-slot-class-name slot-def))) + (when c (find-class c)))) + (defun key-or-base-slot-p (slot-def) "takes a slot def and returns whether or not it is a key" (member (view-class-slot-db-kind slot-def) '(:key :base)))