Skip to content

Commit

Permalink
with-connection
Browse files Browse the repository at this point in the history
  • Loading branch information
Ralph Moritz committed Nov 29, 2012
1 parent 0f68794 commit 2d507b7
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/dbi.lisp
Expand Up @@ -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.