Liking cljdoc? Tell your friends :D

wagoe.platform.shell.adapters.database.common.adapter

One DBAdapter implementation, over a per-engine spec.

There used to be four, and they were copies: each query.clj was the same sixty lines turning on two decisions, and each core.clj was thirty lines of delegation. A fix landed in one and not its neighbours — that is how H2 came to carry a table-exists? workaround while SQLite and MySQL reported every table as absent (BOU-430).

A spec names what the port says may differ between engines, and nothing else:

:label for log lines — "MySQL" :dialect what callers dispatch on; nil means PostgreSQL :driver JDBC driver class name :jdbc-url (fn [db-config] -> String) :pool HikariCP defaults :session-statements (fn [db-config] -> seq of JDBC param vectors) :booleans :native or :int :string-match :like or :ilike :table-exists? (fn [datasource table-name] -> boolean) :table-info (fn [datasource table-name] -> vector of column maps)

One `DBAdapter` implementation, over a per-engine spec.

There used to be four, and they were copies: each `query.clj` was the same
sixty lines turning on two decisions, and each `core.clj` was thirty lines of
delegation. A fix landed in one and not its neighbours — that is how H2 came
to carry a `table-exists?` workaround while SQLite and MySQL reported every
table as absent (BOU-430).

A spec names what the port says may differ between engines, and nothing else:

  :label              for log lines — "MySQL"
  :dialect            what callers dispatch on; nil means PostgreSQL
  :driver             JDBC driver class name
  :jdbc-url           (fn [db-config] -> String)
  :pool               HikariCP defaults
  :session-statements (fn [db-config] -> seq of JDBC param vectors)
  :booleans           :native or :int
  :string-match       :like or :ilike
  :table-exists?      (fn [datasource table-name] -> boolean)
  :table-info         (fn [datasource table-name] -> vector of column maps)
raw docstring

boolean->dbclj

(boolean->db representation value)

Encode value the way representation (:native or :int) stores booleans.

Encode `value` the way `representation` (:native or :int) stores booleans.
sourceraw docstring

build-where-clauseclj

(build-where-clause {:keys [string-match booleans]} filters)

Build a WHERE fragment from filters, in this engine's terms.

string-match is the containment operator (PostgreSQL matches case-insensitively with ILIKE; the rest use LIKE) and booleans is how the engine stores a boolean. Those two were the whole of the difference between the four copies this replaces.

Build a WHERE fragment from `filters`, in this engine's terms.

`string-match` is the containment operator (PostgreSQL matches
case-insensitively with ILIKE; the rest use LIKE) and `booleans` is how the
engine stores a boolean. Those two were the whole of the difference between
the four copies this replaces.
sourceraw docstring

db->booleanclj

(db->boolean representation value)

Decode a stored boolean written by boolean->db.

Decode a stored boolean written by `boolean->db`.
sourceraw docstring

new-adapterclj

(new-adapter spec)

Build the adapter described by spec. See this namespace's docstring.

Build the adapter described by `spec`. See this namespace's docstring.
sourceraw docstring

run-session-statements!clj

(run-session-statements! label datasource statements)

Run each statement, and keep going when one fails.

Session settings are best-effort: a connection that could not be told to use UTC still works. They are run independently because they used to share a single try — MySQL's sql_mode is rejected by MySQL 8, which meant the timezone and charset statements after it never ran at all (BOU-367).

Run each statement, and keep going when one fails.

Session settings are best-effort: a connection that could not be told to use
UTC still works. They are run independently because they used to share a
single try — MySQL's `sql_mode` is rejected by MySQL 8, which meant the
timezone and charset statements after it never ran at all (BOU-367).
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close