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
ConstructorsModifierConstructorDescriptionprotectedDbStatementBase(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 nextStringparameter 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 nextStringparameter to the map of named parameters (e.g.addParam(String name, BigDecimal parameter) Add nextBigDecimalparameter to the map of named parameters (e.g.addParam(String name, BigInteger parameter) Add nextBigIntegerparameter to the map of named parameters (e.g.addParam(BigDecimal parameter) Add nextBigDecimalparameter to the list of ordered parameters (e.g.addParam(BigInteger parameter) Add nextBigIntegerparameter 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> TdoExecute(BiFunction<CompletableFuture<Long>, DbClientServiceContext, T> function) Execute the statement with interception.protected Sidentity()Get this instance as the correct type.indexedParam(Object parameters) Configure parameters usingObjectinstance with registered mapper.namedParam(Object parameters) Configure parameters usingObjectinstance with registered mapper.Get the statement parameters.Configure parameters from aListby order.Configure named parameters.abstract DbStatementTypeGet the statement type.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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-DbExecuteContextextending 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:DbStatementConfigure parameters usingObjectinstance with registered mapper. The statement must use named parameters and configure them from the map provided by mapper.- Specified by:
namedParamin interfaceDbStatement<S extends DbStatement<S>>- Parameters:
parameters-Objectinstance containing parameters- Returns:
- updated db statement
-
indexedParam
Description copied from interface:DbStatementConfigure parameters usingObjectinstance with registered mapper. The statement must use indexed parameters and configure them by order in the array provided by mapper.- Specified by:
indexedParamin interfaceDbStatement<S extends DbStatement<S>>- Parameters:
parameters-Objectinstance containing parameters- Returns:
- updated db statement
-
params
Description copied from interface:DbStatementConfigure parameters from aListby order. The statement must use indexed parameters and configure them by order in the provided array.- Specified by:
paramsin 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:DbStatementConfigure named parameters. The statement must use named parameters and configure them from the provided map.- Specified by:
paramsin interfaceDbStatement<S extends DbStatement<S>>- Parameters:
parameters- named parameters to set on this statement- Returns:
- updated db statement
-
addParam
Description copied from interface:DbStatementAdd next parameter to the list of ordered parameters (e.g. the ones that use?in SQL).- Specified by:
addParamin interfaceDbStatement<S extends DbStatement<S>>- Parameters:
parameter- next parameter to set on this statement- Returns:
- updated db statement
-
addParam
Description copied from interface:DbStatementAdd next parameter to the map of named parameters (e.g. the ones that use:namein Helidon JDBC SQL integration).- Specified by:
addParamin interfaceDbStatement<S extends DbStatement<S>>- Parameters:
name- name of parameterparameter- value of parameter- Returns:
- updated db statement
-
addParam
Description copied from interface:DbStatementAdd next boolean parameter to the list of ordered parameters (e.g. the ones that use?in SQL).- Specified by:
addParamin interfaceDbStatement<S extends DbStatement<S>>- Parameters:
parameter- next parameter to set on this statement- Returns:
- updated db statement
-
addParam
Description copied from interface:DbStatementAdd nextStringparameter to the list of ordered parameters (e.g. the ones that use?in SQL).- Specified by:
addParamin interfaceDbStatement<S extends DbStatement<S>>- Parameters:
parameter- next parameter to set on this statement- Returns:
- updated db statement
-
addParam
Description copied from interface:DbStatementAdd next byte parameter to the list of ordered parameters (e.g. the ones that use?in SQL).- Specified by:
addParamin interfaceDbStatement<S extends DbStatement<S>>- Parameters:
parameter- next parameter to set on this statement- Returns:
- updated db statement
-
addParam
Description copied from interface:DbStatementAdd next short parameter to the list of ordered parameters (e.g. the ones that use?in SQL).- Specified by:
addParamin interfaceDbStatement<S extends DbStatement<S>>- Parameters:
parameter- next parameter to set on this statement- Returns:
- updated db statement
-
addParam
Description copied from interface:DbStatementAdd next integer parameter to the list of ordered parameters (e.g. the ones that use?in SQL).- Specified by:
addParamin interfaceDbStatement<S extends DbStatement<S>>- Parameters:
parameter- next parameter to set on this statement- Returns:
- updated db statement
-
addParam
Description copied from interface:DbStatementAdd next long parameter to the list of ordered parameters (e.g. the ones that use?in SQL).- Specified by:
addParamin interfaceDbStatement<S extends DbStatement<S>>- Parameters:
parameter- next parameter to set on this statement- Returns:
- updated db statement
-
addParam
Description copied from interface:DbStatementAdd next float parameter to the list of ordered parameters (e.g. the ones that use?in SQL).- Specified by:
addParamin interfaceDbStatement<S extends DbStatement<S>>- Parameters:
parameter- next parameter to set on this statement- Returns:
- updated db statement
-
addParam
Description copied from interface:DbStatementAdd next double parameter to the list of ordered parameters (e.g. the ones that use?in SQL).- Specified by:
addParamin interfaceDbStatement<S extends DbStatement<S>>- Parameters:
parameter- next parameter to set on this statement- Returns:
- updated db statement
-
addParam
Description copied from interface:DbStatementAdd nextBigIntegerparameter to the list of ordered parameters (e.g. the ones that use?in SQL).- Specified by:
addParamin interfaceDbStatement<S extends DbStatement<S>>- Parameters:
parameter- next parameter to set on this statement- Returns:
- updated db statement
-
addParam
Description copied from interface:DbStatementAdd nextBigDecimalparameter to the list of ordered parameters (e.g. the ones that use?in SQL).- Specified by:
addParamin interfaceDbStatement<S extends DbStatement<S>>- Parameters:
parameter- next parameter to set on this statement- Returns:
- updated db statement
-
addParam
Description copied from interface:DbStatementAdd next byte[] parameter to the list of ordered parameters (e.g. the ones that use?in SQL).- Specified by:
addParamin interfaceDbStatement<S extends DbStatement<S>>- Parameters:
parameter- next parameter to set on this statement- Returns:
- updated db statement
-
addParam
Description copied from interface:DbStatementAdd next boolean parameter to the map of named parameters (e.g. the ones that use:namein Helidon JDBC SQL integration).- Specified by:
addParamin interfaceDbStatement<S extends DbStatement<S>>- Parameters:
name- name of parameterparameter- value of parameter- Returns:
- updated db statement
-
addParam
Description copied from interface:DbStatementAdd nextStringparameter to the map of named parameters (e.g. the ones that use:namein Helidon JDBC SQL integration).- Specified by:
addParamin interfaceDbStatement<S extends DbStatement<S>>- Parameters:
name- name of parameterparameter- value of parameter- Returns:
- updated db statement
-
addParam
Description copied from interface:DbStatementAdd next byte parameter to the map of named parameters (e.g. the ones that use:namein Helidon JDBC SQL integration).- Specified by:
addParamin interfaceDbStatement<S extends DbStatement<S>>- Parameters:
name- name of parameterparameter- value of parameter- Returns:
- updated db statement
-
addParam
Description copied from interface:DbStatementAdd next short parameter to the map of named parameters (e.g. the ones that use:namein Helidon JDBC SQL integration).- Specified by:
addParamin interfaceDbStatement<S extends DbStatement<S>>- Parameters:
name- name of parameterparameter- value of parameter- Returns:
- updated db statement
-
addParam
Description copied from interface:DbStatementAdd next int parameter to the map of named parameters (e.g. the ones that use:namein Helidon JDBC SQL integration).- Specified by:
addParamin interfaceDbStatement<S extends DbStatement<S>>- Parameters:
name- name of parameterparameter- value of parameter- Returns:
- updated db statement
-
addParam
Description copied from interface:DbStatementAdd next long parameter to the map of named parameters (e.g. the ones that use:namein Helidon JDBC SQL integration).- Specified by:
addParamin interfaceDbStatement<S extends DbStatement<S>>- Parameters:
name- name of parameterparameter- value of parameter- Returns:
- updated db statement
-
addParam
Description copied from interface:DbStatementAdd next float parameter to the map of named parameters (e.g. the ones that use:namein Helidon JDBC SQL integration).- Specified by:
addParamin interfaceDbStatement<S extends DbStatement<S>>- Parameters:
name- name of parameterparameter- value of parameter- Returns:
- updated db statement
-
addParam
Description copied from interface:DbStatementAdd next double parameter to the map of named parameters (e.g. the ones that use:namein Helidon JDBC SQL integration).- Specified by:
addParamin interfaceDbStatement<S extends DbStatement<S>>- Parameters:
name- name of parameterparameter- value of parameter- Returns:
- updated db statement
-
addParam
Description copied from interface:DbStatementAdd nextBigIntegerparameter to the map of named parameters (e.g. the ones that use:namein Helidon JDBC SQL integration).- Specified by:
addParamin interfaceDbStatement<S extends DbStatement<S>>- Parameters:
name- name of parameterparameter- value of parameter- Returns:
- updated db statement
-
addParam
Description copied from interface:DbStatementAdd nextBigDecimalparameter to the map of named parameters (e.g. the ones that use:namein Helidon JDBC SQL integration).- Specified by:
addParamin interfaceDbStatement<S extends DbStatement<S>>- Parameters:
name- name of parameterparameter- value of parameter- Returns:
- updated db statement
-
addParam
Description copied from interface:DbStatementAdd next byte[] parameter to the map of named parameters (e.g. the ones that use:namein Helidon JDBC SQL integration).- Specified by:
addParamin 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
-