Skip to content

v0.4.0

Latest

Choose a tag to compare

@yogthos yogthos released this 01 Sep 02:50
d85f391

Two breaking changes for consumers.

ffi/write argument order (#14)

jolt 0.8.0 reversed ffi/write's value and offset arguments; the drivers here moved with it. deps.edn declares :jolt/min-version "0.8.0" so an older runtime refuses to run rather than writing to the wrong place — both spellings are integers, so the mistake is otherwise silent.

clojure.jdbc replaces the reimplementation (#12, #15)

jdbc.core is now the published clojure.jdbc running on the java.sql shim in db.jdbc-shim, rather than a reimplementation of that API here.

Non-standard helpers are gone. jdbc/last-insert-id in particular: clojure.jdbc has no such function, and the generated key comes back from the insert itself.

;; before
(jdbc/execute! conn (sql/format {:insert-into :t :values [{:name n}]}))
(jdbc/last-insert-id conn)

;; after
(:id (first (jdbc/insert! conn :t {:name n} {:returning true})))

Require db.jdbc once before jdbc.core, and before anything else that pulls it in — clojure.jdbc's namespaces resolve the java.sql constants as they compile.

#15: the java.sql surface clojure.jdbc actually reaches for

Running upstream's own test suite against the shim for the first time turned up five gaps. That suite previously could not load at all; it now passes whole — 25 tests, 78 assertions, 0 failures.

  • DriverManager/getConnection is served, which is where clojure.jdbc's dbspec->connection ends.
  • Class/forName resolves the two driver classnames this library backs, so {:classname "org.sqlite.JDBC"} specs work.
  • Default transaction isolation is the driver's: sqlite answers SERIALIZABLE, postgres READ_COMMITTED. Both previously reported READ_COMMITTED.
  • executeBatch raises BatchUpdateException, the class the JVM throws.
  • PreparedStatement answers getConnection.

The last needed the class hierarchy too: jdbc.impl imports the class and extends protocols to the bare PreparedStatement, and an extension written against a simple name is filed under the extending namespace unless jolt models the class — so the arm silently never fired and (jdbc/fetch conn stmt) failed with No method fetch in jdbc.proto/IFetch.

Verified against the released jolt v0.8.0: upstream's suite, this library's own suite, and examples/ring-app end to end over the wire.