clj-r2dbc.impl.sql.statement
Statement preparation utilities for clj-r2dbc.
Provides a single seam for statement creation and option application that is
shared between impl/execute/core and impl/connection/lifecycle (streaming).
Centralizing these operations here removes duplication between execute and streaming paths.
Provides:
apply-opts! - apply :fetch-size and :returning opts to a Statement.
create-statement - create a Statement from a Connection and SQL string.
bind! - bind a params collection to a Statement (delegates to impl/sql/params).
prepare! - compose create-statement + apply-opts! + bind! in one call.
This namespace is an implementation detail; do not use from application code.
apply-opts!
(apply-opts! stmt opts)
Apply Statement options from opts to stmt. No-ops when keys absent.
Args:
stmt - the R2DBC Statement to configure.
opts - options map; relevant keys:
:fetch-size - calls Statement.fetchSize(int); must be >= 0 and
<= Integer/MAX_VALUE.
:returning - calls Statement.returnGeneratedValues(String...).
Returns nil; call for side effects only.bind!
(bind! stmt params)
Bind params to stmt. Delegates to impl/sql/params/bind-params!.
Args:
stmt - the R2DBC Statement to bind to.
params - sequential collection of parameter values.
Returns stmt for chaining.
create-statement
(create-statement conn sql)
Create an R2DBC Statement from conn and sql.
Args:
conn - an active R2DBC Connection; must be non-nil.
sql - the SQL string; must be non-nil.
Returns the created Statement.
prepare!
(prepare! conn sql params opts)
Create a Statement, apply opts, and bind params in one call.
Args:
conn - an active R2DBC Connection.
sql - the SQL string.
params - sequential collection of parameter values.
opts - options map (see apply-opts! for supported keys).
Returns the prepared Statement.