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 Details

    • DbStatementBase

      protected DbStatementBase(DbExecuteContext context)
      Create a new instance.
      Parameters:
      context - context
  • Method Details

    • context

      public DbExecuteContext context()
      Get the execution context.
      Returns:
      execution context
    • context

      protected <C extends DbExecuteContext> C context(Class<C> cls)
      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

      public DbStatementParameters parameters()
      Get the statement parameters.
      Returns:
      statement parameters
    • statementType

      public abstract DbStatementType statementType()
      Get the statement type.
      Returns:
      statement type
    • doExecute

      protected <T> T doExecute(BiFunction<CompletableFuture<Long>,DbClientServiceContext,T> function)
      Execute the statement with interception.
      Type Parameters:
      T - query result type
      Parameters:
      function - function used to compute the query result
      Returns:
      query result
    • autoClose

      protected static <T> Stream<T> autoClose(Stream<T> stream)
      Decorate the given stream to invoke BaseStream.close() on terminal operations.
      Type Parameters:
      T - the type of the stream elements
      Parameters:
      stream - stream to decorate
      Returns:
      decorated stream
    • namedParam

      public S namedParam(Object parameters)
      Description copied from interface: DbStatement
      Configure parameters using Object instance with registered mapper. The statement must use named parameters and configure them from the map provided by mapper.
      Specified by:
      namedParam in interface DbStatement<S extends DbStatement<S>>
      Parameters:
      parameters - Object instance containing parameters
      Returns:
      updated db statement
    • indexedParam

      public S indexedParam(Object parameters)
      Description copied from interface: DbStatement
      Configure parameters using Object 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 interface DbStatement<S extends DbStatement<S>>
      Parameters:
      parameters - Object instance containing parameters
      Returns:
      updated db statement
    • params

      public S params(List<?> parameters)
      Description copied from interface: DbStatement
      Configure parameters from a List by order. The statement must use indexed parameters and configure them by order in the provided array.
      Specified by:
      params in interface DbStatement<S extends DbStatement<S>>
      Parameters:
      parameters - ordered parameters to set on this statement, never null
      Returns:
      updated db statement
    • params

      public S params(Map<String,?> parameters)
      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 interface DbStatement<S extends DbStatement<S>>
      Parameters:
      parameters - named parameters to set on this statement
      Returns:
      updated db statement
    • addParam

      public S addParam(Object parameter)
      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 interface DbStatement<S extends DbStatement<S>>
      Parameters:
      parameter - next parameter to set on this statement
      Returns:
      updated db statement
    • addParam

      public S addParam(String name, Object parameter)
      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 interface DbStatement<S extends DbStatement<S>>
      Parameters:
      name - name of parameter
      parameter - value of parameter
      Returns:
      updated db statement
    • addParam

      public S addParam(boolean parameter)
      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 interface DbStatement<S extends DbStatement<S>>
      Parameters:
      parameter - next parameter to set on this statement
      Returns:
      updated db statement
    • addParam

      public S addParam(String parameter)
      Description copied from interface: DbStatement
      Add next String parameter to the list of ordered parameters (e.g. the ones that use ? in SQL).
      Specified by:
      addParam in interface DbStatement<S extends DbStatement<S>>
      Parameters:
      parameter - next parameter to set on this statement
      Returns:
      updated db statement
    • addParam

      public S addParam(byte parameter)
      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 interface DbStatement<S extends DbStatement<S>>
      Parameters:
      parameter - next parameter to set on this statement
      Returns:
      updated db statement
    • addParam

      public S addParam(short parameter)
      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 interface DbStatement<S extends DbStatement<S>>
      Parameters:
      parameter - next parameter to set on this statement
      Returns:
      updated db statement
    • addParam

      public S addParam(int parameter)
      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 interface DbStatement<S extends DbStatement<S>>
      Parameters:
      parameter - next parameter to set on this statement
      Returns:
      updated db statement
    • addParam

      public S addParam(long parameter)
      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 interface DbStatement<S extends DbStatement<S>>
      Parameters:
      parameter - next parameter to set on this statement
      Returns:
      updated db statement
    • addParam

      public S addParam(float parameter)
      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 interface DbStatement<S extends DbStatement<S>>
      Parameters:
      parameter - next parameter to set on this statement
      Returns:
      updated db statement
    • addParam

      public S addParam(double parameter)
      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 interface DbStatement<S extends DbStatement<S>>
      Parameters:
      parameter - next parameter to set on this statement
      Returns:
      updated db statement
    • addParam

      public S addParam(BigInteger parameter)
      Description copied from interface: DbStatement
      Add next BigInteger parameter to the list of ordered parameters (e.g. the ones that use ? in SQL).
      Specified by:
      addParam in interface DbStatement<S extends DbStatement<S>>
      Parameters:
      parameter - next parameter to set on this statement
      Returns:
      updated db statement
    • addParam

      public S addParam(BigDecimal parameter)
      Description copied from interface: DbStatement
      Add next BigDecimal parameter to the list of ordered parameters (e.g. the ones that use ? in SQL).
      Specified by:
      addParam in interface DbStatement<S extends DbStatement<S>>
      Parameters:
      parameter - next parameter to set on this statement
      Returns:
      updated db statement
    • addParam

      public S addParam(byte[] parameter)
      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 interface DbStatement<S extends DbStatement<S>>
      Parameters:
      parameter - next parameter to set on this statement
      Returns:
      updated db statement
    • addParam

      public S addParam(String name, boolean parameter)
      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 interface DbStatement<S extends DbStatement<S>>
      Parameters:
      name - name of parameter
      parameter - value of parameter
      Returns:
      updated db statement
    • addParam

      public S addParam(String name, String parameter)
      Description copied from interface: DbStatement
      Add next String parameter to the map of named parameters (e.g. the ones that use :name in Helidon JDBC SQL integration).
      Specified by:
      addParam in interface DbStatement<S extends DbStatement<S>>
      Parameters:
      name - name of parameter
      parameter - value of parameter
      Returns:
      updated db statement
    • addParam

      public S addParam(String name, byte parameter)
      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 interface DbStatement<S extends DbStatement<S>>
      Parameters:
      name - name of parameter
      parameter - value of parameter
      Returns:
      updated db statement
    • addParam

      public S addParam(String name, short parameter)
      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 interface DbStatement<S extends DbStatement<S>>
      Parameters:
      name - name of parameter
      parameter - value of parameter
      Returns:
      updated db statement
    • addParam

      public S addParam(String name, int parameter)
      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 interface DbStatement<S extends DbStatement<S>>
      Parameters:
      name - name of parameter
      parameter - value of parameter
      Returns:
      updated db statement
    • addParam

      public S addParam(String name, long parameter)
      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 interface DbStatement<S extends DbStatement<S>>
      Parameters:
      name - name of parameter
      parameter - value of parameter
      Returns:
      updated db statement
    • addParam

      public S addParam(String name, float parameter)
      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 interface DbStatement<S extends DbStatement<S>>
      Parameters:
      name - name of parameter
      parameter - value of parameter
      Returns:
      updated db statement
    • addParam

      public S addParam(String name, double parameter)
      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 interface DbStatement<S extends DbStatement<S>>
      Parameters:
      name - name of parameter
      parameter - value of parameter
      Returns:
      updated db statement
    • addParam

      public S addParam(String name, BigInteger parameter)
      Description copied from interface: DbStatement
      Add next BigInteger parameter to the map of named parameters (e.g. the ones that use :name in Helidon JDBC SQL integration).
      Specified by:
      addParam in interface DbStatement<S extends DbStatement<S>>
      Parameters:
      name - name of parameter
      parameter - value of parameter
      Returns:
      updated db statement
    • addParam

      public S addParam(String name, BigDecimal parameter)
      Description copied from interface: DbStatement
      Add next BigDecimal parameter to the map of named parameters (e.g. the ones that use :name in Helidon JDBC SQL integration).
      Specified by:
      addParam in interface DbStatement<S extends DbStatement<S>>
      Parameters:
      name - name of parameter
      parameter - value of parameter
      Returns:
      updated db statement
    • addParam

      public S addParam(String name, byte[] parameter)
      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 interface DbStatement<S extends DbStatement<S>>
      Parameters:
      name - name of parameter
      parameter - value of parameter
      Returns:
      updated db statement
    • identity

      protected S identity()
      Get this instance as the correct type.
      Returns:
      this instance typed to correct type