Interface DbClientServiceContext

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 Details

    • context

      Context context()
      Context with parameters passed from the caller, such as SpanContext 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 the DbClientProvider.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

      DbClientServiceContext statement(String stmt, List<Object> parameters)
      Set a new statement with indexed parameters to be used.
      Parameters:
      stmt - statement text
      parameters - indexed parameters
      Returns:
      updated interceptor context
    • statement

      DbClientServiceContext statement(String stmt, Map<String,Object> parameters)
      Set a new statement with named parameters to be used.
      Parameters:
      stmt - statement text
      parameters - named parameters
      Returns:
      updated interceptor context
    • parameters

      DbClientServiceContext parameters(List<Object> 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

      DbClientServiceContext parameters(Map<String,Object> 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

      DbClientServiceContext context(Context 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

      DbClientServiceContext statement(String name)
      Set a new statement to be used.
      Parameters:
      name - statement text to use
      Returns:
      updated interceptor context
    • statementName

      DbClientServiceContext statementName(String name)
      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 context
      stmtType - statement type
      stmtFuture - statement future
      queryFuture - query future
      stmtParams - statement parameters
      Returns:
      new client service context