next.jdbc on top of rsqlite's own connection.
(require '[ebifriedrice.rsqlite :as rsql] '[ebifriedrice.rsqlite.jdbc :as rjdbc] '[next.jdbc :as jdbc])
(def eng (rsql/connect)) (def ds (rjdbc/data-source eng)) (jdbc/execute! ds ["create table t (id integer primary key, s text)"]) (jdbc/execute-one! ds ["insert into t (s) values (?)" "hi"])
The data source implements javax.sql.DataSource over the engine's org.sqlite.jni handle; jdbc/execute!, execute-one!, plan/select! and jdbc/transact work, and every write lands on the same connection the preupdate hook watches - so reactive queries re-run with full column-level precision, exactly as writes through exec!/transact!.
Semantics and limits: one statement per call (the binding prepares the first statement only); setObject accepts Long, Double, String, byte [], Boolean and nil; transactions follow next.jdbc's use of setAutoCommit/commit/rollback (BEGIN on setAutoCommit(false), COMMIT/ROLLBACK on the shared handle, where the engine's rollback hook discards pending events); generated keys are not supported; close() on the connection is a no-op - the engine owns the connection's lifetime.
next.jdbc is an optional dependency: consumers add seancorfield/next.jdbc; nothing else in rsqlite needs it.
next.jdbc on top of rsqlite's own connection.
(require '[ebifriedrice.rsqlite :as rsql]
'[ebifriedrice.rsqlite.jdbc :as rjdbc]
'[next.jdbc :as jdbc])
(def eng (rsql/connect))
(def ds (rjdbc/data-source eng))
(jdbc/execute! ds ["create table t (id integer primary key, s text)"])
(jdbc/execute-one! ds ["insert into t (s) values (?)" "hi"])
The data source implements javax.sql.DataSource over the engine's
org.sqlite.jni handle; jdbc/execute!, execute-one!, plan/select!
and jdbc/transact work, and every write lands on the same
connection the preupdate hook watches - so reactive queries
re-run with full column-level precision, exactly as writes
through exec!/transact!.
Semantics and limits: one statement per call (the binding
prepares the first statement only); setObject accepts Long,
Double, String, byte [], Boolean and nil; transactions follow
next.jdbc's use of setAutoCommit/commit/rollback (BEGIN on
setAutoCommit(false), COMMIT/ROLLBACK on the shared handle, where
the engine's rollback hook discards pending events); generated
keys are not supported; close() on the connection is a no-op -
the engine owns the connection's lifetime.
next.jdbc is an optional dependency: consumers add
seancorfield/next.jdbc; nothing else in rsqlite needs it.(data-source eng)A javax.sql.DataSource over the engine's connection: next.jdbc against it writes through the same handle the preupdate hook observes, so registered queries re-run with full precision.
A javax.sql.DataSource over the engine's connection: next.jdbc against it writes through the same handle the preupdate hook observes, so registered queries re-run with full precision.
(-engine ds)The engine this data source exposes.
The engine this data source exposes.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |