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.
execute-batch!
provides a way to add batches of parameters to a
PreparedStatement
and then execute it in batch mode (via .executeBatch
).
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. `execute-batch!` provides a way to add batches of parameters to a `PreparedStatement` and then execute it in batch mode (via `.executeBatch`). Defines the `SettableParameter` protocol for converting Clojure values to database-specific values.
(create con
sql
params
{:keys [return-keys result-type concurrency cursors fetch-size max-rows
timeout]})
This is an implementation detail -- use next.jdbc/prepare
instead.
Given a Connection
, a SQL string, some parameters, and some options,
return a PreparedStatement
representing that.
This is an implementation detail -- use `next.jdbc/prepare` instead. Given a `Connection`, a SQL string, some parameters, and some options, return a `PreparedStatement` representing that.
(execute-batch! ps param-groups)
(execute-batch! ps param-groups opts)
Given a PreparedStatement
and a vector containing parameter groups,
i.e., a vector of vector of parameters, use .addBatch
to add each group
of parameters to the prepared statement (via set-parameters
) and then
call .executeBatch
. A vector of update counts is returned.
An options hash map may also be provided, containing :batch-size
which
determines how to partition the parameter groups for submission to the
database. If omitted, all groups will be submitted as a single command.
If you expect the update counts to be larger than Integer/MAX_VALUE
,
you can specify :large true
and .executeLargeBatch
will be called
instead.
Returns a Clojure vector of update counts.
May throw java.sql.BatchUpdateException
if any part of the batch fails.
You may be able to call .getUpdateCounts
on that exception object to
get more information about which parts succeeded and which failed.
For additional caveats and database-specific options you may need, see: https://cljdoc.org/d/seancorfield/next.jdbc/CURRENT/doc/getting-started/prepared-statements#caveats
Not all databases support batch execution.
Given a `PreparedStatement` and a vector containing parameter groups, i.e., a vector of vector of parameters, use `.addBatch` to add each group of parameters to the prepared statement (via `set-parameters`) and then call `.executeBatch`. A vector of update counts is returned. An options hash map may also be provided, containing `:batch-size` which determines how to partition the parameter groups for submission to the database. If omitted, all groups will be submitted as a single command. If you expect the update counts to be larger than `Integer/MAX_VALUE`, you can specify `:large true` and `.executeLargeBatch` will be called instead. Returns a Clojure vector of update counts. May throw `java.sql.BatchUpdateException` if any part of the batch fails. You may be able to call `.getUpdateCounts` on that exception object to get more information about which parts succeeded and which failed. For additional caveats and database-specific options you may need, see: https://cljdoc.org/d/seancorfield/next.jdbc/CURRENT/doc/getting-started/prepared-statements#caveats Not all databases support batch execution.
(set-parameters ps params)
Given a PreparedStatement
and a vector of parameter values, update the
PreparedStatement
with those parameters and return it.
Given a `PreparedStatement` and a vector of parameter values, update the `PreparedStatement` with those parameters and return it.
Protocol for setting SQL parameters in statement objects, which
can convert from Clojure values. The default implementation just
calls .setObject
on the parameter value. It can be extended to
use other methods of PreparedStatement
to convert and set parameter
values. Extension via metadata is supported.
Protocol for setting SQL parameters in statement objects, which can convert from Clojure values. The default implementation just calls `.setObject` on the parameter value. It can be extended to use other methods of `PreparedStatement` to convert and set parameter values. Extension via metadata is supported.
(set-parameter val stmt ix)
Convert a Clojure value into a SQL value and store it as the ix'th parameter in the given SQL statement object.
Convert a Clojure value into a SQL value and store it as the ix'th parameter in the given SQL statement object.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close