What?
Clojure’s contrib wrapper for JDBC.
Where?
https://github.com/clojure/java.jdbc
[org.clojure/java.jdbc “0.7.0-beta1”]
Summary?
Adds reducible queries; Drops support for Clojure 1.4.0 (see below).
Details?
A new function, reducible-query, has been added that accepts a db-spec and a
SQL/parameters vector, and returns a “reducible collection”. The query doesn’t
actually run until you reduce it. At that point, it sets up the
PreparedStatement, runs the query, and processes the ResultSet – by creating an
interim “reducible collection” version of that result set and delegating your
reduce operation to that. The connection is automatically closed when reduction
completes, either by processing the entire result set or by returning a
‘reduced’ value. If you’re on Clojure 1.7 or later, you can therefore use
reducible-query with transducers. Note that the reducible collection returned
by reducible-query can be processed multiple times and the query will be run
each time. There’s also a reducible-result-set helper function which will
transform a ResultSet into a single-pass reducible collection if you need to
drop down to that level (which you can use with the existing
db-query-with-resultset function).
Clojure version support?
This beta release supports Clojure 1.5 forward.
It implements reducible queries using CollReduce on Clojure 1.5/1.6.
It implements reducible queries using IReduce on Clojure 1.7+
I’d prefer to use IReduceInit and only support Clojure 1.7+ going
forward.
Please provide feedback on how that might affect you:
https://www.surveymonkey.com/r/MR2HRFD
Thanks to?
Kevin Downey for opening https://dev.clojure.org/jira/browse/JDBC-99
three years ago and Ghadi Shayban for the outline of the reducible ResultSet!
Sean Corfield -- (904) 302-SEAN -- (970) FOR-SEAN
An Architect's View -- http://corfield.org/
"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 [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.