commit c150020c5c3903b21cae3cd2e0865f428dba8e28
parent 956ddea609474b385651a9c705680c3225acd123
Author: Tomas Hlavaty <tom@logand.com>
Date: Sat, 13 Aug 2011 22:48:24 +0200
with-psequences added
Diffstat:
1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/orm.lisp b/orm.lisp
@@ -264,11 +264,21 @@
(cons (sym 'oid) (mapcar (lambda (x) (sym (pslot-name x))) pslots))))))
(defmacro with-pclasses (names &body body)
- (labels ((rec (rest)
- (if rest
+ (labels ((rec (x)
+ (if x
`(progn
- (2sql-orm:setup-pclass ',(car rest))
- (unwind-protect ,(rec (cdr rest))
- (2sql:query () '(q:drop-table ,(car rest) t t))))
+ (2sql-orm:setup-pclass ',(car x))
+ (unwind-protect ,(rec (cdr x))
+ (2sql:query () '(q:drop-table ,(car x) t t))))
`(progn ,@body))))
(rec names)))
+
+(defmacro with-psequences (names &body body)
+ (labels ((rec (x)
+ (if x
+ `(progn
+ (2sql:query () '(q:create-sequence ,(car x)))
+ (unwind-protect ,(rec (cdr x))
+ (2sql:query () '(q:drop-sequence ,(car x) t))))
+ `(progn ,@body))))
+ (rec names)))
+\ No newline at end of file