Hi!

In my opinion, this has a lot of boilerplate for basic operation like this
(reuse a connection for few operations).

The deprecated api of clojure.java.jdbc had some useful methods for do it
more concise and intuitive, you can use it.
Also, you can try use a connection pool for avoid this boilerplate or find
a more concise alternative to clojure.java.jdbc library.

My two cents.

Andrey


2013/12/10 Sean Corfield <seancorfi...@gmail.com>

> No, you don't have to use db-transaction (although that will have that
> effect).
>
> You can get a connection and assoc it into the db-spec with a
> :connection key and pass that across multiple queries etc, and it will
> reuse the :connection passed in:
>
> (with-open [con (get-connection db-spec)]
>   (let [connected (add-connection db-spec con)]
>     ... several queries etc using connected instead of db-spec ...
>   ))
>
> Sean
>
>
> On Tue, Dec 10, 2013 at 8:24 AM, Niels van Klaveren
> <niels.vanklave...@gmail.com> wrote:
> > Do I understand correctly that to prevent creating a collection per
> query I
> > have to wrap multiple consecutive queries inside a `db-transaction`
> binding
> > instead of the old `with-connection` bindings ?
> >
> > --
> > --
> > 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.
>
>
>
> --
> Sean A Corfield -- (904) 302-SEAN
> An Architect's View -- http://corfield.org/
> World Singles, LLC. -- http://worldsingles.com/
>
> "Perfection is the enemy of the good."
> -- Gustave Flaubert, French realist novelist (1821-1880)
>
> --
> --
> 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.
>



-- 
Andrey Antukh - Андрей Антух - <n...@niwi.be>
http://www.niwi.be/about.html
http://www.kaleidos.net/A5694F/

"Linux is for people who hate Windows, BSD is for people who love UNIX"
"Social Engineer -> Because there is no patch for human stupidity"

-- 
-- 
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