What?
org.clojure/java.jdbc “0.5.6”
Clojure contrib wrapper for JDBC database operations
Where?
https://github.com/clojure/java.jdbc#change-log
TL;DR:
Variadic calls to most functions have been deprecated in favor of fixed
argument calls in order to make the functions more composable in use. This
affects any calls that provided options, as well as any `insert!` that inserted
multiple rows!
Why?
In the previous versions (0.5.0 and earlier), options to most functions
were specified as inline unrolled keyword/value arguments:
(jdbc/query db [“select * from foo where id = ?” pk]
:row-fn :name :result-set-fn first :identifiers identity)
Whilst this style of argument is convenient from the REPL, it becomes
increasingly awkward as you start composing functions – you start having to use
`apply` and `mapcat identity` and so on.
Version 0.5.5 introduced a single options map argument into (nearly)
all functions that previously took unrolled keyword/value arguments. It is the
optional, last argument in all cases.
(jdbc/query db [“select * from foo where id = ?” pk]
{:row-fn :name :result-set-fn first :identifiers identity})
Version 0.5.6 extends this to `create-table-ddl` and `insert!`. It also
introduces `insert-multi!` and deprecates the multi-row capability of `insert!`
-- the variadic call:
;; deprecated
(jdbc/insert! db {:row “1” :data “first”} {:row “2” :data “second”})
(jdbc/insert! db [:row :data] [“3” “third”] [“4” “fourth”])
;; use this instead
(jdbc/insert-multi! db [{:row “1” :data “first”}
{:row “2” :data “second”}])
(jdbc/insert-multi! db [:row :data]
[[“3” “third”]
[“4” “fourth”]])
Version 0.5.6 continues to support the unrolled arguments but considers
them deprecated – and using them will cause a DEPRECATED message to be printed
to stdout (this was already true for `db-transaction` which was deprecated in
favor of `with-db-transaction` back in version 0.3.0).
Plans?
Version 0.6.0 will remove all deprecated functionality (including the
old API which continued in java.jdbc.deprecated for several versions).
Sean Corfield -- (904) 302-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.