Interface JdbcClient.Statement
- Enclosing interface:
JdbcClient
Bind positions use JDBC indexes, which start at one. The stage accepts exactly one terminal operation and is not safe for concurrent use.
-
Method Summary
Modifier and TypeMethodDescriptionBinds a supported scalar value that is notnull.longexecute()Executes an update and returns its update count as alongvalue.Selects generated key execution.<T> JdbcClient.Rows<T> map(JdbcClient.RowMapper<T> mapper) Selects an explicit mapper for query rows.<T> JdbcClient.Rows<T> Selects mapping from the first column for a supported scalar type.
-
Method Details
-
bind
Binds a supported scalar value that is notnull.- Parameters:
index- JDBC position, starting at onevalue- supported scalar value- Returns:
- this statement
- Throws:
NullPointerException- if the value isnullIllegalArgumentException- if the position or value is invalidIllegalStateException- if a terminal operation has started
-
execute
long execute()Executes an update and returns its update count as alongvalue.Helidon's JDBC provider uses the large update count when the driver supports it. Otherwise, the provider returns the legacy integer update count as a
longvalue.A connection owned by the operation uses auto-commit. A failure reported after the update executes, including while processing the result or releasing JDBC resources, does not establish that the database made no changes. Applications must not retry the update automatically.
- Returns:
- update count
- Throws:
DataException- if JDBC execution failsIllegalStateException- if a bind is missing or a terminal operation has started
-
map
Selects an explicit mapper for query rows.- Type Parameters:
T- mapped type- Parameters:
mapper- row mapper- Returns:
- terminal stage for materialized rows
- Throws:
NullPointerException- if the mapper isnullIllegalStateException- if a terminal operation has started
-
map
Selects mapping from the first column for a supported scalar type.JdbcClient.Rows.one()andJdbcClient.Rows.list()require a column value that is notnull.JdbcClient.Rows.optional()returnsOptional.empty()both when no row is returned and when exactly one row contains SQLNULLin column one. Applications that need to distinguish those states can usemap(RowMapper)with a mapper that returns anOptional; the outer optional returned byJdbcClient.Rows.optional()then represents row presence.- Type Parameters:
T- mapped scalar type- Parameters:
scalarType- scalar type- Returns:
- terminal stage for materialized rows
- Throws:
NullPointerException- if the type isnullIllegalArgumentException- if the scalar type is not supportedIllegalStateException- if a terminal operation has started
-
generatedKeys
JdbcClient.GeneratedKeys generatedKeys()Selects generated key execution.Adding no columns requests the driver's default generated keys. Configuration does not acquire JDBC resources.
- Returns:
- generated key configuration stage
- Throws:
IllegalStateException- if a terminal operation has started
-