Permalink
Browse files

with-connection

  • Loading branch information...
Ralph Moritz
Ralph Moritz committed Nov 29, 2012
1 parent 0f68794 commit 2d507b749b0db7aa34e981e88ffd7d96fa9a2777
Showing with 7 additions and 0 deletions.
  1. +7 −0 src/dbi.lisp
View
@@ -83,3 +83,10 @@
(if ,ok
(commit ,conn-var)
(rollback ,conn-var))))))
+
+@export
+(defmacro with-connection ((conn-sym &rest rest) &body body)
+ `(let ((,conn-sym (connect ,@rest)))
+ (unwind-protect
+ (progn ,@body)
+ (disconnect ,conn-sym))))

0 comments on commit 2d507b7

Please sign in to comment.