X-Git-Url: http://git.kpe.io/?p=clsql.git;a=blobdiff_plain;f=sql%2Fmetaclasses.lisp;h=a9e3ccd84efe2290fdd74e1f705e203981472634;hp=2a0b4b9b2c835c30f194c46674b4c2fe795e65b0;hb=1eb686cfa4935e1252b2813ec6391bd781e88508;hpb=25a0c03ff7abc8fdc619a6bf4c1ab6dec26a2dc9 diff --git a/sql/metaclasses.lisp b/sql/metaclasses.lisp index 2a0b4b9..a9e3ccd 100644 --- a/sql/metaclasses.lisp +++ b/sql/metaclasses.lisp @@ -1,8 +1,6 @@ ;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10 -*- ;;;; ************************************************************************* ;;;; -;;;; $Id$ -;;;; ;;;; CLSQL metaclass for standard-db-objects created in the OODDL. ;;;; ;;;; This file is part of CLSQL. @@ -427,29 +425,17 @@ implementations." (car list) list)) -(defmethod initialize-instance :around ((obj view-class-direct-slot-definition) - &rest initargs) - (do* ((parsed (list obj)) - (name (first initargs) (first initargs)) - (val (second initargs) (second initargs)) - (type nil) - (db-constraints nil)) - ((null initargs) - (setq parsed - (append parsed - (list 'specified-type type - :type (compute-lisp-type-from-specified-type - type db-constraints)))) - (apply #'call-next-method parsed)) - (case name - (:db-constraints - (setq db-constraints val) - (setq parsed (append parsed (list name val)))) - (:type - (setq type val)) - (t - (setq parsed (append parsed (list name val))))) - (setq initargs (cddr initargs)))) +(defmethod initialize-instance :around + ((obj view-class-direct-slot-definition) + &rest initargs &key db-constraints db-kind type &allow-other-keys) + (when (and (not db-kind) (member :primary-key (listify db-constraints))) + (warn "Slot ~S constrained to be :primary-key, but not marked as :db-kind :key" + (slot-definition-name obj))) + (apply #'call-next-method obj + 'specified-type type + :type (compute-lisp-type-from-specified-type + type db-constraints) + initargs)) (defmethod compute-effective-slot-definition ((class standard-db-class) #+kmr-normal-cesd slot-name