Interface PreparedStatementBinder

All Known Subinterfaces:
AsyncCassandraTemplate.AsyncPreparedStatementHandler, AsyncCassandraTemplate.AsyncPreparedStatementHandler, ReactiveCassandraTemplate.ReactivePreparedStatementHandler
All Known Implementing Classes:
ArgumentPreparedStatementBinder, AsyncCassandraTemplate.PreparedStatementHandler, CassandraTemplate.PreparedStatementHandler, ReactiveCassandraTemplate.PreparedStatementHandler
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface PreparedStatementBinder
General callback interface used by the CqlTemplate and ReactiveCqlTemplate classes.

This interface binds values on a PreparedStatement provided by the CqlTemplate class, for each of a number of updates in a batch using the same CQL. Implementations are responsible for setting any necessary parameters. CQL with placeholders will already have been supplied.

It's easier to use this interface than PreparedStatementCreator: The CqlTemplate will create the PreparedStatement, with the callback only being responsible for setting parameter values.

Implementations do not need to concern themselves with DriverExceptions that may be thrown from operations they attempt. The CqlTemplate class will catch and handle DriverException appropriately.

Author:
David Webb, Mark Paluch
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    com.datastax.oss.driver.api.core.cql.BoundStatement
    bindValues(com.datastax.oss.driver.api.core.cql.PreparedStatement ps)
    Bind parameter values on the given PreparedStatement.
  • Method Details

    • bindValues

      com.datastax.oss.driver.api.core.cql.BoundStatement bindValues(com.datastax.oss.driver.api.core.cql.PreparedStatement ps) throws com.datastax.oss.driver.api.core.DriverException
      Bind parameter values on the given PreparedStatement.
      Parameters:
      ps - the PreparedStatement to invoke setter methods on.
      Throws:
      com.datastax.oss.driver.api.core.DriverException - if a DriverException is encountered (i.e. there is no need to catch DriverException)