Permalink
Browse files

Merge pull request #7 from ralph-moeritz/master

with-connection macro
  • Loading branch information...
2 parents 0f68794 + 2d507b7 commit 19abb54b260d7a6196760e81bd9907ae9d7e6fb7 @fukamachi committed Nov 29, 2012
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 19abb54

Please sign in to comment.