The public API of the next generation java.jdbc library.
The basic building blocks are the java.sql
/javax.sql
classes:
DataSource
-- something to get connections from,Connection
-- an active connection to the database,PreparedStatement
-- SQL and parameters combined, from a connection,and the following functions and a macro:
plan
-- given a connectable and SQL + parameters or a statement,
return a reducible that, when reduced will execute the SQL and consume
the ResultSet
produced,execute!
-- given a connectable and SQL + parameters or a statement,
execute the SQL, consume the ResultSet
produced, and return a vector
of hash maps representing the rows (@1); this can be datafied to allow
navigation of foreign keys into other tables (either by convention or
via a schema definition),execute-one!
-- given a connectable and SQL + parameters or a statement,
execute the SQL, consume the first row of the ResultSet
produced, and
return a hash map representing that row; this can be datafied to allow
navigation of foreign keys into other tables (either by convention or
via a schema definition),prepare
-- given a Connection
and SQL + parameters, construct a new
PreparedStatement
; in general this should be used with with-open
,transact
-- the functional implementation of with-transaction
,with-transaction
-- execute a series of SQL operations within a transaction.@1 result sets are built, by default, as vectors of hash maps, containing qualified keywords as column names, but the row builder and result set builder machinery is open and alternatives are provided to produce unqualified keywords as column names, and to produce a vector the column names followed by vectors of column values for each row, and lower-case variants of each.
The following options are supported wherever a PreparedStatement
is created:
:concurrency
-- :read-only
, :updatable
,:cursors
-- :close
, :hold
:fetch-size
-- the fetch size value,:max-rows
-- the maximum number of rows to return,:result-type
-- :forward-only
, :scroll-insensitive
, :scroll-sensitive
,:return-keys
-- either true
or a vector of key names to return,:timeout
-- the query timeout.The public API of the next generation java.jdbc library. The basic building blocks are the `java.sql`/`javax.sql` classes: * `DataSource` -- something to get connections from, * `Connection` -- an active connection to the database, * `PreparedStatement` -- SQL and parameters combined, from a connection, and the following functions and a macro: * `plan` -- given a connectable and SQL + parameters or a statement, return a reducible that, when reduced will execute the SQL and consume the `ResultSet` produced, * `execute!` -- given a connectable and SQL + parameters or a statement, execute the SQL, consume the `ResultSet` produced, and return a vector of hash maps representing the rows (@1); this can be datafied to allow navigation of foreign keys into other tables (either by convention or via a schema definition), * `execute-one!` -- given a connectable and SQL + parameters or a statement, execute the SQL, consume the first row of the `ResultSet` produced, and return a hash map representing that row; this can be datafied to allow navigation of foreign keys into other tables (either by convention or via a schema definition), * `prepare` -- given a `Connection` and SQL + parameters, construct a new `PreparedStatement`; in general this should be used with `with-open`, * `transact` -- the functional implementation of `with-transaction`, * `with-transaction` -- execute a series of SQL operations within a transaction. @1 result sets are built, by default, as vectors of hash maps, containing qualified keywords as column names, but the row builder and result set builder machinery is open and alternatives are provided to produce unqualified keywords as column names, and to produce a vector the column names followed by vectors of column values for each row, and lower-case variants of each. The following options are supported wherever a `PreparedStatement` is created: * `:concurrency` -- `:read-only`, `:updatable`, * `:cursors` -- `:close`, `:hold` * `:fetch-size` -- the fetch size value, * `:max-rows` -- the maximum number of rows to return, * `:result-type` -- `:forward-only`, `:scroll-insensitive`, `:scroll-sensitive`, * `:return-keys` -- either `true` or a vector of key names to return, * `:timeout` -- the query timeout.
Standard implementations of get-datasource
and get-connection
.
Standard implementations of `get-datasource` and `get-connection`.
No vars found in this namespace.
Mostly an implementation namespace for how PreparedStatement objects
are
created by the next generation java.jdbc library.
set-parameters
is public and may be useful if you have a PreparedStatement
that you wish to reuse and (re)set the parameters on it.
Defines the SettableParameter
protocol for converting Clojure values
to database-specific values.
Mostly an implementation namespace for how `PreparedStatement objects` are created by the next generation java.jdbc library. `set-parameters` is public and may be useful if you have a `PreparedStatement` that you wish to reuse and (re)set the parameters on it. Defines the `SettableParameter` protocol for converting Clojure values to database-specific values.
This is the extensible core of the next generation java.jdbc library.
Sourceable
-- for producing javax.sql.DataSource
objects,Connectable
-- for producing new java.sql.Connection
objects,Executable
-- for executing SQL operations,Preparable
-- for producing new java.sql.PreparedStatement
objects,Transactable
-- for executing SQL operations transactionally.This is the extensible core of the next generation java.jdbc library. * `Sourceable` -- for producing `javax.sql.DataSource` objects, * `Connectable` -- for producing new `java.sql.Connection` objects, * `Executable` -- for executing SQL operations, * `Preparable` -- for producing new `java.sql.PreparedStatement` objects, * `Transactable` -- for executing SQL operations transactionally.
Provides functions for use with the :table-fn
and :column-fn
options
that define how SQL entities should be quoted in strings constructed
from Clojure data.
Provides functions for use with the `:table-fn` and `:column-fn` options that define how SQL entities should be quoted in strings constructed from Clojure data.
An implementation of ResultSet
handling functions.
Defines the following protocols:
DatafiableRow
-- for turning a row into something datafiableReadableColumn
-- to read column values by label or indexRowBuilder
-- for materializing a rowResultSetBuilder
-- for materializing a result setAlso provides the default implemenations for Executable
and
the default datafy
/nav
behavior for rows from a result set.
An implementation of `ResultSet` handling functions. Defines the following protocols: * `DatafiableRow` -- for turning a row into something datafiable * `ReadableColumn` -- to read column values by label or index * `RowBuilder` -- for materializing a row * `ResultSetBuilder` -- for materializing a result set Also provides the default implemenations for `Executable` and the default `datafy`/`nav` behavior for rows from a result set.
Specs for the core API of next.jdbc.
The functions from next.jdbc
and next.jdbc.sql
have specs here.
Just :args
are spec'd. These specs are intended to aid development
with next.jdbc
by catching simple errors in calling the library.
The connectable
argument is currently just any?
but both
get-datasource
and get-connection
have stricter specs. If you
extend Sourceable
or Connectable
, those specs will likely be too strict.
In addition, there is an instrument
function that provides a simple
way to instrument all of the next.jdbc
functions.
Specs for the core API of next.jdbc. The functions from `next.jdbc` and `next.jdbc.sql` have specs here. Just `:args` are spec'd. These specs are intended to aid development with `next.jdbc` by catching simple errors in calling the library. The `connectable` argument is currently just `any?` but both `get-datasource` and `get-connection` have stricter specs. If you extend `Sourceable` or `Connectable`, those specs will likely be too strict. In addition, there is an `instrument` function that provides a simple way to instrument all of the `next.jdbc` functions.
Some utility functions that make common operations easier by
providing some syntactic sugar over execute!
/execute-one!
.
This is intended to provide a minimal level of parity with
clojure.java.jdbc
(insert!
, update!
, delete!
, etc).
For anything more complex, use a library like HoneySQL
https://github.com/jkk/honeysql to generate SQL + parameters.
The following options are supported:
:table-fn
-- specify a function used to convert table names (strings)
to SQL entity names -- see the next.jdbc.quoted
namespace for the
most common quoting strategy functions,:column-fn
-- specify a function used to convert column names (strings)
to SQL entity names -- see the next.jdbc.quoted
namespace for the
most common quoting strategy functions.In addition, find-by-keys
supports :order-by
to add an ORDER BY
clause to the generated SQL.
Some utility functions that make common operations easier by providing some syntactic sugar over `execute!`/`execute-one!`. This is intended to provide a minimal level of parity with `clojure.java.jdbc` (`insert!`, `update!`, `delete!`, etc). For anything more complex, use a library like HoneySQL https://github.com/jkk/honeysql to generate SQL + parameters. The following options are supported: * `:table-fn` -- specify a function used to convert table names (strings) to SQL entity names -- see the `next.jdbc.quoted` namespace for the most common quoting strategy functions, * `:column-fn` -- specify a function used to convert column names (strings) to SQL entity names -- see the `next.jdbc.quoted` namespace for the most common quoting strategy functions. In addition, `find-by-keys` supports `:order-by` to add an `ORDER BY` clause to the generated SQL.
SQL Transaction logic.
SQL Transaction logic.
No vars found in this namespace.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close