Hey all,
    The current version of the (with-connection) macro in clojure-
contrib doesn't return the result of its body. (It just returns nil
from the commit() call at the end of the transaction). I attach a
patch to achieve this behaviour, so it can be used in a functional
style.

Meredydd
--

Patch against today's SVN HEAD:

Index: src/clojure/contrib/sql/sql.clj
===================================================================
--- src/clojure/contrib/sql/sql.clj     (revision 161)
+++ src/clojure/contrib/sql/sql.clj     (working copy)
@@ -31,8 +31,9 @@
   `(with-open ~con ~init
      (try
       (.setAutoCommit ~con false))
-      [EMAIL PROTECTED]
-      (.commit ~con)
+      (let [body-result# (do [EMAIL PROTECTED])]
+       (.commit ~con)
+       body-result)
       (catch Exception e#
              (.rollback ~con)
              (throw (Exception. "transaction rolled back" e#)))))

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to