Class ReactiveCassandraTemplate.PreparedStatementHandler
java.lang.Object
org.springframework.data.cassandra.core.ReactiveCassandraTemplate.PreparedStatementHandler
- All Implemented Interfaces:
CqlProvider
,PreparedStatementBinder
,ReactivePreparedStatementCreator
,ReactiveCassandraTemplate.ReactivePreparedStatementHandler
- Enclosing class:
- ReactiveCassandraTemplate
public static class ReactiveCassandraTemplate.PreparedStatementHandler
extends Object
implements ReactiveCassandraTemplate.ReactivePreparedStatementHandler
Utility class to prepare a
SimpleStatement
and bind values associated with the statement to a
BoundStatement
.- Since:
- 3.2
-
Constructor Summary
ConstructorDescriptionPreparedStatementHandler
(com.datastax.oss.driver.api.core.cql.Statement<?> statement) -
Method Summary
Modifier and TypeMethodDescriptioncom.datastax.oss.driver.api.core.cql.BoundStatement
bindValues
(com.datastax.oss.driver.api.core.cql.PreparedStatement ps) Bind parameter values on the givenPreparedStatement
.reactor.core.publisher.Mono<com.datastax.oss.driver.api.core.cql.PreparedStatement>
createPreparedStatement
(ReactiveSession session) Create a statement in this session.getCql()
Return the CQL string for this object, i.e. typically the CQL used for creating statements.
-
Constructor Details
-
PreparedStatementHandler
public PreparedStatementHandler(com.datastax.oss.driver.api.core.cql.Statement<?> statement)
-
-
Method Details
-
createPreparedStatement
public reactor.core.publisher.Mono<com.datastax.oss.driver.api.core.cql.PreparedStatement> createPreparedStatement(ReactiveSession session) throws com.datastax.oss.driver.api.core.DriverException Description copied from interface:ReactivePreparedStatementCreator
Create a statement in this session. Allows implementations to usePreparedStatement
s. TheReactiveCqlTemplate
will attempt to cache thePreparedStatement
s for future use without the overhead of re-preparing on the entire cluster.- Specified by:
createPreparedStatement
in interfaceReactivePreparedStatementCreator
- Parameters:
session
- Session to use to create statement, must not be null.- Returns:
- a prepared statement.
- Throws:
com.datastax.oss.driver.api.core.DriverException
- there is no need to catch DriverException that may be thrown in the implementation of this method. TheReactiveCqlTemplate
class will handle them.
-
bindValues
public 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 Description copied from interface:PreparedStatementBinder
Bind parameter values on the givenPreparedStatement
.- Specified by:
bindValues
in interfacePreparedStatementBinder
- Parameters:
ps
- the PreparedStatement to invoke setter methods on.- Throws:
com.datastax.oss.driver.api.core.DriverException
- if aDriverException
is encountered (i.e. there is no need to catchDriverException
)
-
getCql
Description copied from interface:CqlProvider
Return the CQL string for this object, i.e. typically the CQL used for creating statements.- Specified by:
getCql
in interfaceCqlProvider
- Returns:
- the CQL string.
-