- All Known Implementing Classes:
DbClientServiceContextImpl
public interface DbClientServiceContext
Interceptor context to get (and possibly manipulate) database operations.
This is a mutable object - acts as a builder during the invocation of DbClientService
.
The interceptors are executed sequentially, so there is no need for synchronization.
-
Method Summary
Modifier and TypeMethodDescriptioncontext()
Context with parameters passed from the caller, such asSpanContext
for tracing.Set a new context to be used by other interceptors and when executing the statement.static DbClientServiceContext
create
(DbExecuteContext execContext, DbStatementType stmtType, CompletionStage<Void> stmtFuture, CompletionStage<Long> queryFuture, DbStatementParameters stmtParams) Create a new client service context.dbType()
Type of this database (usually the same string used by theDbClientProvider.name()
).parameters
(List<Object> parameters) Set new indexed parameters to be used.parameters
(Map<String, Object> parameters) Set new named parameters to be used.A stage that is completed once the results were fully read.Text of the statement to be executed.Set a new statement to be used.Set a new statement with indexed parameters to be used.Set a new statement with named parameters to be used.A stage that is completed once the statement finishes execution.Name of a statement to be executed.statementName
(String name) Set a new statement name to be used.Get the statement parameters.Type of the statement being executed.
-
Method Details
-
context
Context context()Context with parameters passed from the caller, such asSpanContext
for tracing.- Returns:
- context associated with this request
-
statement
String statement()Text of the statement to be executed.- Returns:
- statement text
-
statementName
String statementName()Name of a statement to be executed. Ad hoc statements have names generated.- Returns:
- name of the statement
-
statementType
DbStatementType statementType()Type of the statement being executed.- Returns:
- statement type
-
statementParameters
DbStatementParameters statementParameters()Get the statement parameters.- Returns:
- statement parameters
-
dbType
String dbType()Type of this database (usually the same string used by theDbClientProvider.name()
).- Returns:
- type of database
-
statementFuture
CompletionStage<Void> statementFuture()A stage that is completed once the statement finishes execution.- Returns:
- statement future
-
resultFuture
CompletionStage<Long> resultFuture()A stage that is completed once the results were fully read. The number returns either the number of modified records or the number of records actually read.- Returns:
- stage that completes once all query results were processed.
-
statement
Set a new statement with indexed parameters to be used.- Parameters:
stmt
- statement textparameters
- indexed parameters- Returns:
- updated interceptor context
-
statement
Set a new statement with named parameters to be used.- Parameters:
stmt
- statement textparameters
- named parameters- Returns:
- updated interceptor context
-
parameters
Set new indexed parameters to be used.- Parameters:
parameters
- parameters- Returns:
- updated interceptor context
- Throws:
IllegalArgumentException
- in case the statement is using named parameters
-
parameters
Set new named parameters to be used.- Parameters:
parameters
- parameters- Returns:
- updated interceptor context
- Throws:
IllegalArgumentException
- in case the statement is using indexed parameters
-
context
Set a new context to be used by other interceptors and when executing the statement.- Parameters:
context
- context to use- Returns:
- updated interceptor context
-
statement
Set a new statement to be used.- Parameters:
name
- statement text to use- Returns:
- updated interceptor context
-
statementName
Set a new statement name to be used.- Parameters:
name
- statement name to use- Returns:
- updated interceptor context
-
create
static DbClientServiceContext create(DbExecuteContext execContext, DbStatementType stmtType, CompletionStage<Void> stmtFuture, CompletionStage<Long> queryFuture, DbStatementParameters stmtParams) Create a new client service context.- Parameters:
execContext
- execution contextstmtType
- statement typestmtFuture
- statement futurequeryFuture
- query futurestmtParams
- statement parameters- Returns:
- new client service context
-