Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

with-connection macro #7

Merged
merged 1 commit into from

2 participants

@rmoritz

with-connection macro to ensure connections are closed after executing SQL.

Ralph Moritz with-connection 2d507b7
@fukamachi fukamachi merged commit 19abb54 into from
@fukamachi
Owner

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 29, 2012
  1. with-connection

    Ralph Moritz authored
This page is out of date. Refresh to see the latest.
Showing with 7 additions and 0 deletions.
  1. +7 −0 src/dbi.lisp
View
7 src/dbi.lisp
@@ -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))))
Something went wrong with that request. Please try again.