Does db-transaction work in your case?

"Evaluates body in the context of a transaction on the specified database 
connection.

The binding provides the database connection for the transaction and the name 
to which
that is bound for evaluation of the body.
See db-transaction* for more details."

Given a spec, you can use db-transaction like this:

(db-transaction [t-db spec]

  (insert! t-db ...)

  (update! t-db ...)

  ...)


On Wednesday, August 14, 2013 8:02:52 PM UTC-7, Kyle Cordes wrote:
>
> Hello. I've coded quite a lot of JDBC usage in Java, and enough Clojure to 
> know my way around pretty well; yet I've been unable to figure out the 
> following by reading the source and docs for clojure.java.jdbc. I've read 
> http://clojure.github.io/java.jdbc/ and many pages linked from there.
>
> The question is:
>
> How do I get a connection, then run a series of operations on that same 
> connection? All the API I can find (except for the deprecated, pre-0.3 API) 
> seems to work on a model of: give it a DB connection spec, it connects, 
> runs, and disconnects. Great for playing with a command at a time, less so 
> for doing a series of things that need to happen on the same connection.
>
> -- 
> Kyle Cordes
> http://kylecordes.com
>
>

-- 
-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to