Module io.helidon.dbclient
Package io.helidon.dbclient
Class DbStatementBase<S extends DbStatement<S>>
java.lang.Object
io.helidon.dbclient.DbStatementBase<S>
- Type Parameters:
S
- type of subclass
- All Implemented Interfaces:
DbStatement<S>
- Direct Known Subclasses:
JdbcStatement
,MongoDbStatementDml
,MongoDbStatementGet
,MongoDbStatementQuery
public abstract class DbStatementBase<S extends DbStatement<S>>
extends Object
implements DbStatement<S>
Base
DbStatement
implementation.-
Constructor Summary
ModifierConstructorDescriptionprotected
DbStatementBase
(DbExecuteContext context) Create a new instance. -
Method Summary
Modifier and TypeMethodDescriptionaddParam
(boolean parameter) Add next boolean parameter to the list of ordered parameters (e.g.addParam
(byte parameter) Add next byte parameter to the list of ordered parameters (e.g.addParam
(byte[] parameter) Add next byte[] parameter to the list of ordered parameters (e.g.addParam
(double parameter) Add next double parameter to the list of ordered parameters (e.g.addParam
(float parameter) Add next float parameter to the list of ordered parameters (e.g.addParam
(int parameter) Add next integer parameter to the list of ordered parameters (e.g.addParam
(long parameter) Add next long parameter to the list of ordered parameters (e.g.addParam
(short parameter) Add next short parameter to the list of ordered parameters (e.g.Add next parameter to the list of ordered parameters (e.g.Add nextString
parameter to the list of ordered parameters (e.g.Add next boolean parameter to the map of named parameters (e.g.Add next byte parameter to the map of named parameters (e.g.Add next byte[] parameter to the map of named parameters (e.g.Add next double parameter to the map of named parameters (e.g.Add next float parameter to the map of named parameters (e.g.Add next int parameter to the map of named parameters (e.g.Add next long parameter to the map of named parameters (e.g.Add next short parameter to the map of named parameters (e.g.Add next parameter to the map of named parameters (e.g.Add nextString
parameter to the map of named parameters (e.g.addParam
(String name, BigDecimal parameter) Add nextBigDecimal
parameter to the map of named parameters (e.g.addParam
(String name, BigInteger parameter) Add nextBigInteger
parameter to the map of named parameters (e.g.addParam
(BigDecimal parameter) Add nextBigDecimal
parameter to the list of ordered parameters (e.g.addParam
(BigInteger parameter) Add nextBigInteger
parameter to the list of ordered parameters (e.g.protected static <T> Stream
<T> Decorate the given stream to invokeBaseStream.close()
on terminal operations.context()
Get the execution context.protected <C extends DbExecuteContext>
CReturns execution context cast to it's extending class.protected <T> T
doExecute
(BiFunction<CompletableFuture<Long>, DbClientServiceContext, T> function) Execute the statement with interception.protected S
identity()
Get this instance as the correct type.indexedParam
(Object parameters) Configure parameters usingObject
instance with registered mapper.namedParam
(Object parameters) Configure parameters usingObject
instance with registered mapper.Get the statement parameters.Configure parameters from aList
by order.Configure named parameters.abstract DbStatementType
Get the statement type.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.helidon.dbclient.DbStatement
params
-
Constructor Details
-
DbStatementBase
Create a new instance.- Parameters:
context
- context
-
-
Method Details
-
context
Get the execution context.- Returns:
- execution context
-
context
Returns execution context cast to it's extending class.- Type Parameters:
C
- execution context extending type- Parameters:
cls
-DbExecuteContext
extending class- Returns:
- extended execution context
-
parameters
Get the statement parameters.- Returns:
- statement parameters
-
statementType
Get the statement type.- Returns:
- statement type
-
doExecute
Execute the statement with interception.- Type Parameters:
T
- query result type- Parameters:
function
- function used to compute the query result- Returns:
- query result
-
autoClose
Decorate the given stream to invokeBaseStream.close()
on terminal operations.- Type Parameters:
T
- the type of the stream elements- Parameters:
stream
- stream to decorate- Returns:
- decorated stream
-
namedParam
Description copied from interface:DbStatement
Configure parameters usingObject
instance with registered mapper. The statement must use named parameters and configure them from the map provided by mapper.- Specified by:
namedParam
in interfaceDbStatement<S extends DbStatement<S>>
- Parameters:
parameters
-Object
instance containing parameters- Returns:
- updated db statement
-
indexedParam
Description copied from interface:DbStatement
Configure parameters usingObject
instance with registered mapper. The statement must use indexed parameters and configure them by order in the array provided by mapper.- Specified by:
indexedParam
in interfaceDbStatement<S extends DbStatement<S>>
- Parameters:
parameters
-Object
instance containing parameters- Returns:
- updated db statement
-
params
Description copied from interface:DbStatement
Configure parameters from aList
by order. The statement must use indexed parameters and configure them by order in the provided array.- Specified by:
params
in interfaceDbStatement<S extends DbStatement<S>>
- Parameters:
parameters
- ordered parameters to set on this statement, never null- Returns:
- updated db statement
-
params
Description copied from interface:DbStatement
Configure named parameters. The statement must use named parameters and configure them from the provided map.- Specified by:
params
in interfaceDbStatement<S extends DbStatement<S>>
- Parameters:
parameters
- named parameters to set on this statement- Returns:
- updated db statement
-
addParam
Description copied from interface:DbStatement
Add next parameter to the list of ordered parameters (e.g. the ones that use?
in SQL).- Specified by:
addParam
in interfaceDbStatement<S extends DbStatement<S>>
- Parameters:
parameter
- next parameter to set on this statement- Returns:
- updated db statement
-
addParam
Description copied from interface:DbStatement
Add next parameter to the map of named parameters (e.g. the ones that use:name
in Helidon JDBC SQL integration).- Specified by:
addParam
in interfaceDbStatement<S extends DbStatement<S>>
- Parameters:
name
- name of parameterparameter
- value of parameter- Returns:
- updated db statement
-
addParam
Description copied from interface:DbStatement
Add next boolean parameter to the list of ordered parameters (e.g. the ones that use?
in SQL).- Specified by:
addParam
in interfaceDbStatement<S extends DbStatement<S>>
- Parameters:
parameter
- next parameter to set on this statement- Returns:
- updated db statement
-
addParam
Description copied from interface:DbStatement
Add nextString
parameter to the list of ordered parameters (e.g. the ones that use?
in SQL).- Specified by:
addParam
in interfaceDbStatement<S extends DbStatement<S>>
- Parameters:
parameter
- next parameter to set on this statement- Returns:
- updated db statement
-
addParam
Description copied from interface:DbStatement
Add next byte parameter to the list of ordered parameters (e.g. the ones that use?
in SQL).- Specified by:
addParam
in interfaceDbStatement<S extends DbStatement<S>>
- Parameters:
parameter
- next parameter to set on this statement- Returns:
- updated db statement
-
addParam
Description copied from interface:DbStatement
Add next short parameter to the list of ordered parameters (e.g. the ones that use?
in SQL).- Specified by:
addParam
in interfaceDbStatement<S extends DbStatement<S>>
- Parameters:
parameter
- next parameter to set on this statement- Returns:
- updated db statement
-
addParam
Description copied from interface:DbStatement
Add next integer parameter to the list of ordered parameters (e.g. the ones that use?
in SQL).- Specified by:
addParam
in interfaceDbStatement<S extends DbStatement<S>>
- Parameters:
parameter
- next parameter to set on this statement- Returns:
- updated db statement
-
addParam
Description copied from interface:DbStatement
Add next long parameter to the list of ordered parameters (e.g. the ones that use?
in SQL).- Specified by:
addParam
in interfaceDbStatement<S extends DbStatement<S>>
- Parameters:
parameter
- next parameter to set on this statement- Returns:
- updated db statement
-
addParam
Description copied from interface:DbStatement
Add next float parameter to the list of ordered parameters (e.g. the ones that use?
in SQL).- Specified by:
addParam
in interfaceDbStatement<S extends DbStatement<S>>
- Parameters:
parameter
- next parameter to set on this statement- Returns:
- updated db statement
-
addParam
Description copied from interface:DbStatement
Add next double parameter to the list of ordered parameters (e.g. the ones that use?
in SQL).- Specified by:
addParam
in interfaceDbStatement<S extends DbStatement<S>>
- Parameters:
parameter
- next parameter to set on this statement- Returns:
- updated db statement
-
addParam
Description copied from interface:DbStatement
Add nextBigInteger
parameter to the list of ordered parameters (e.g. the ones that use?
in SQL).- Specified by:
addParam
in interfaceDbStatement<S extends DbStatement<S>>
- Parameters:
parameter
- next parameter to set on this statement- Returns:
- updated db statement
-
addParam
Description copied from interface:DbStatement
Add nextBigDecimal
parameter to the list of ordered parameters (e.g. the ones that use?
in SQL).- Specified by:
addParam
in interfaceDbStatement<S extends DbStatement<S>>
- Parameters:
parameter
- next parameter to set on this statement- Returns:
- updated db statement
-
addParam
Description copied from interface:DbStatement
Add next byte[] parameter to the list of ordered parameters (e.g. the ones that use?
in SQL).- Specified by:
addParam
in interfaceDbStatement<S extends DbStatement<S>>
- Parameters:
parameter
- next parameter to set on this statement- Returns:
- updated db statement
-
addParam
Description copied from interface:DbStatement
Add next boolean parameter to the map of named parameters (e.g. the ones that use:name
in Helidon JDBC SQL integration).- Specified by:
addParam
in interfaceDbStatement<S extends DbStatement<S>>
- Parameters:
name
- name of parameterparameter
- value of parameter- Returns:
- updated db statement
-
addParam
Description copied from interface:DbStatement
Add nextString
parameter to the map of named parameters (e.g. the ones that use:name
in Helidon JDBC SQL integration).- Specified by:
addParam
in interfaceDbStatement<S extends DbStatement<S>>
- Parameters:
name
- name of parameterparameter
- value of parameter- Returns:
- updated db statement
-
addParam
Description copied from interface:DbStatement
Add next byte parameter to the map of named parameters (e.g. the ones that use:name
in Helidon JDBC SQL integration).- Specified by:
addParam
in interfaceDbStatement<S extends DbStatement<S>>
- Parameters:
name
- name of parameterparameter
- value of parameter- Returns:
- updated db statement
-
addParam
Description copied from interface:DbStatement
Add next short parameter to the map of named parameters (e.g. the ones that use:name
in Helidon JDBC SQL integration).- Specified by:
addParam
in interfaceDbStatement<S extends DbStatement<S>>
- Parameters:
name
- name of parameterparameter
- value of parameter- Returns:
- updated db statement
-
addParam
Description copied from interface:DbStatement
Add next int parameter to the map of named parameters (e.g. the ones that use:name
in Helidon JDBC SQL integration).- Specified by:
addParam
in interfaceDbStatement<S extends DbStatement<S>>
- Parameters:
name
- name of parameterparameter
- value of parameter- Returns:
- updated db statement
-
addParam
Description copied from interface:DbStatement
Add next long parameter to the map of named parameters (e.g. the ones that use:name
in Helidon JDBC SQL integration).- Specified by:
addParam
in interfaceDbStatement<S extends DbStatement<S>>
- Parameters:
name
- name of parameterparameter
- value of parameter- Returns:
- updated db statement
-
addParam
Description copied from interface:DbStatement
Add next float parameter to the map of named parameters (e.g. the ones that use:name
in Helidon JDBC SQL integration).- Specified by:
addParam
in interfaceDbStatement<S extends DbStatement<S>>
- Parameters:
name
- name of parameterparameter
- value of parameter- Returns:
- updated db statement
-
addParam
Description copied from interface:DbStatement
Add next double parameter to the map of named parameters (e.g. the ones that use:name
in Helidon JDBC SQL integration).- Specified by:
addParam
in interfaceDbStatement<S extends DbStatement<S>>
- Parameters:
name
- name of parameterparameter
- value of parameter- Returns:
- updated db statement
-
addParam
Description copied from interface:DbStatement
Add nextBigInteger
parameter to the map of named parameters (e.g. the ones that use:name
in Helidon JDBC SQL integration).- Specified by:
addParam
in interfaceDbStatement<S extends DbStatement<S>>
- Parameters:
name
- name of parameterparameter
- value of parameter- Returns:
- updated db statement
-
addParam
Description copied from interface:DbStatement
Add nextBigDecimal
parameter to the map of named parameters (e.g. the ones that use:name
in Helidon JDBC SQL integration).- Specified by:
addParam
in interfaceDbStatement<S extends DbStatement<S>>
- Parameters:
name
- name of parameterparameter
- value of parameter- Returns:
- updated db statement
-
addParam
Description copied from interface:DbStatement
Add next byte[] parameter to the map of named parameters (e.g. the ones that use:name
in Helidon JDBC SQL integration).- Specified by:
addParam
in interfaceDbStatement<S extends DbStatement<S>>
- Parameters:
name
- name of parameterparameter
- value of parameter- Returns:
- updated db statement
-
identity
Get this instance as the correct type.- Returns:
- this instance typed to correct type
-