Sean Corfield <[email protected]> writes:
> Rather than doing something that requires a dependency on specific JDBC
> driver classes, it seems that if an :auto-commit option in the db-spec were
> honored by get-connection you would get what you needed:
>
> (into [] (take 2) (jdbc/reducible-query (assoc config/db :auto-commit
> false) query {:fetch-size 500}))
>
> You can already pass additional options into the DriverManager/getConnection
> call as properties (from the db-spec) but autocommit does not appear to be
> supported in that format.
>
> Actually, it would be cleaner if get-connection had a 2-arity accepting
> db-spec and opts, and then everything could pass opts into get-connection and
> you could do:
>
> (into [] (take 2) (jdbc/reducible-query config/db query {:fetch-size
> 500 :auto-commit false }))
That would work, but I have to look at which database driver is being
used here when creating the reducible-query. I would have to pass the
right options depending on the database driver being used instead of
passing a {:use-streaming? true} as options.
In my case config/db is really read from a config.edn file and may point
to a mysql, postgresql or sqlite database.
The extend-protocol form would be provided by the user's code, not by
java.jdbc, so there's no dependency on a specific JDBC driver class.
Anyway I could live with both solutions. And I'm aware of the fact that
an additional protocol to turn on streaming also introduces additional
complexity.
Being able to pass the :auto-commit option would already be a nice
improvement since I could get rid of the outer jdbc/with-db-connection.
I hope I've made my point clear. I'm going to trust your best judgement
on this issue from now on.
Thanks again for your work on java.jdbc.
--
Cheers
Ralf
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
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
---
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 [email protected].
For more options, visit https://groups.google.com/d/optout.