commit 8c4f2c24a2166e6e37744a806b5a0a706423d903
parent 5aac1699239579f6ccca31420cfa6b799b084e41
Author: Tomas Hlavaty <tom@logand.com>
Date:   Tue,  6 Sep 2011 23:07:49 +0200
delete-pinstance implemented
Diffstat:
1 file changed, 7 insertions(+), 0 deletions(-)
diff --git a/orm.lisp b/orm.lisp
@@ -536,6 +536,13 @@
                             (mapcar #'car unknown)))
                 appending (list initarg (assert-type v ltype))))))))
 
+(defun delete-pinstance (a)
+  (let ((oid (oid a)))
+    (remhash oid *instance-cache*)
+    (2sql:query (oid)
+      `(q:delete-from ,(type-of a)
+         (q:where (q:= oid (q:qvar oid)))))))
+
 (defparameter *instance-collector-cache* nil) ;; equal form->fn
 
 (defmacro with-pinstance-collector-cache (args &body body)