public interface ReactiveCqlOperations
ReactiveCqlTemplate
. Not often used directly, but a useful option to enhance testability, as it can easily be
mocked or stubbed.ReactiveCqlTemplate
,
Mono
,
Flux
Modifier and Type | Method and Description |
---|---|
reactor.core.publisher.Flux<Boolean> |
execute(org.reactivestreams.Publisher<String> statementPublisher)
Issue multiple CQL statements from a CQL statement
Publisher . |
reactor.core.publisher.Mono<Boolean> |
execute(ReactivePreparedStatementCreator psc)
Issue a single CQL execute operation (such as an insert, update or delete statement) using a
ReactivePreparedStatementCreator to provide CQL and any required parameters. |
<T> reactor.core.publisher.Flux<T> |
execute(ReactivePreparedStatementCreator psc,
ReactivePreparedStatementCallback<T> action)
Execute a CQL data access operation, implemented as callback action working on a CQL
PreparedStatement . |
<T> reactor.core.publisher.Flux<T> |
execute(ReactiveSessionCallback<T> action)
Execute a CQL data access operation, implemented as callback action working on a
ReactiveSession . |
reactor.core.publisher.Mono<Boolean> |
execute(com.datastax.driver.core.Statement statement)
Issue a single CQL execute, typically a DDL statement, insert, update or delete statement.
|
reactor.core.publisher.Mono<Boolean> |
execute(String cql)
Issue a single CQL execute, typically a DDL statement, insert, update or delete statement.
|
reactor.core.publisher.Mono<Boolean> |
execute(String cql,
Object... args)
Issue a single CQL operation (such as an insert, update or delete statement) via a prepared statement, binding the
given arguments.
|
reactor.core.publisher.Mono<Boolean> |
execute(String cql,
PreparedStatementBinder psb)
Issue an statement using a
PreparedStatementBinder to set bind parameters, with given CQL. |
reactor.core.publisher.Flux<Boolean> |
execute(String cql,
org.reactivestreams.Publisher<Object[]> args)
Issue a single CQL operation (such as an insert, update or delete statement) via a prepared statement, binding the
given arguments.
|
<T> reactor.core.publisher.Flux<T> |
execute(String cql,
ReactivePreparedStatementCallback<T> action)
Execute a CQL data access operation, implemented as callback action working on a CQL
PreparedStatement . |
<T> reactor.core.publisher.Flux<T> |
query(ReactivePreparedStatementCreator psc,
PreparedStatementBinder psb,
ReactiveResultSetExtractor<T> rse)
Query using a prepared statement and a
PreparedStatementBinder implementation that knows how to bind values
to the query, reading the ReactiveResultSet with a ResultSetExtractor . |
<T> reactor.core.publisher.Flux<T> |
query(ReactivePreparedStatementCreator psc,
PreparedStatementBinder psb,
RowMapper<T> rowMapper)
Query using a prepared statement and a
PreparedStatementBinder implementation that knows how to bind values
to the query, mapping each row to a Java object via a RowMapper . |
<T> reactor.core.publisher.Flux<T> |
query(ReactivePreparedStatementCreator psc,
ReactiveResultSetExtractor<T> rse)
Query using a prepared statement, reading the
ReactiveResultSet with a ReactiveResultSetExtractor . |
<T> reactor.core.publisher.Flux<T> |
query(ReactivePreparedStatementCreator psc,
RowMapper<T> rowMapper)
Query using a prepared statement, mapping each row to a Java object via a
RowMapper . |
<T> reactor.core.publisher.Flux<T> |
query(com.datastax.driver.core.Statement statement,
ReactiveResultSetExtractor<T> rse)
Execute a query given static CQL, reading the
ReactiveResultSet with a ReactiveResultSetExtractor . |
<T> reactor.core.publisher.Flux<T> |
query(com.datastax.driver.core.Statement statement,
RowMapper<T> rowMapper)
Execute a query given static CQL, mapping each row to a Java object via a
RowMapper . |
<T> reactor.core.publisher.Flux<T> |
query(String cql,
PreparedStatementBinder psb,
ReactiveResultSetExtractor<T> rse)
Query using a prepared statement, reading the
ReactiveResultSet with a ReactiveResultSetExtractor . |
<T> reactor.core.publisher.Flux<T> |
query(String cql,
PreparedStatementBinder psb,
RowMapper<T> rowMapper)
Query given CQL to create a prepared statement from CQL and a
PreparedStatement Binder implementation that
knows how to bind values to the query, mapping each row to a Java object via a RowMapper . |
<T> reactor.core.publisher.Flux<T> |
query(String cql,
ReactiveResultSetExtractor<T> rse)
Execute a query given static CQL, reading the
ReactiveResultSet with a ReactiveResultSetExtractor . |
<T> reactor.core.publisher.Flux<T> |
query(String cql,
ReactiveResultSetExtractor<T> rse,
Object... args)
Query given CQL to create a prepared statement from CQL and a list of arguments to bind to the query, reading the
ReactiveResultSet with a ReactiveResultSetExtractor . |
<T> reactor.core.publisher.Flux<T> |
query(String cql,
RowMapper<T> rowMapper)
Execute a query given static CQL, mapping each row to a Java object via a
RowMapper . |
<T> reactor.core.publisher.Flux<T> |
query(String cql,
RowMapper<T> rowMapper,
Object... args)
Query given CQL to create a prepared statement from CQL and a list of arguments to bind to the query, mapping each
row to a Java object via a
RowMapper . |
reactor.core.publisher.Flux<Map<String,Object>> |
queryForFlux(com.datastax.driver.core.Statement statement)
Execute a query for a result
Flux , given static CQL. |
<T> reactor.core.publisher.Flux<T> |
queryForFlux(com.datastax.driver.core.Statement statement,
Class<T> elementType)
Execute a query for a result
Flux , given static CQL. |
reactor.core.publisher.Flux<Map<String,Object>> |
queryForFlux(String cql)
Execute a query for a result
Flux , given static CQL. |
<T> reactor.core.publisher.Flux<T> |
queryForFlux(String cql,
Class<T> elementType)
Execute a query for a result
Flux , given static CQL. |
<T> reactor.core.publisher.Flux<T> |
queryForFlux(String cql,
Class<T> elementType,
Object... args)
Query given CQL to create a prepared statement from CQL and a list of arguments to bind to the query, expecting a
result
Flux . |
reactor.core.publisher.Flux<Map<String,Object>> |
queryForFlux(String cql,
Object... args)
Query given CQL to create a prepared statement from CQL and a list of arguments to bind to the query, expecting a
result
Flux . |
reactor.core.publisher.Mono<Map<String,Object>> |
queryForMap(com.datastax.driver.core.Statement statement)
Execute a query for a result Map, given static CQL.
|
reactor.core.publisher.Mono<Map<String,Object>> |
queryForMap(String cql)
Execute a query for a result Map, given static CQL.
|
reactor.core.publisher.Mono<Map<String,Object>> |
queryForMap(String cql,
Object... args)
Query given CQL to create a prepared statement from CQL and a list of arguments to bind to the query, expecting a
result Map.
|
<T> reactor.core.publisher.Mono<T> |
queryForObject(com.datastax.driver.core.Statement statement,
Class<T> requiredType)
Execute a query for a result object, given static CQL.
|
<T> reactor.core.publisher.Mono<T> |
queryForObject(com.datastax.driver.core.Statement statement,
RowMapper<T> rowMapper)
Execute a query given static CQL, mapping a single result row to a Java object via a
RowMapper . |
<T> reactor.core.publisher.Mono<T> |
queryForObject(String cql,
Class<T> requiredType)
Execute a query for a result object, given static CQL.
|
<T> reactor.core.publisher.Mono<T> |
queryForObject(String cql,
Class<T> requiredType,
Object... args)
Query given CQL to create a prepared statement from CQL and a list of arguments to bind to the query, expecting a
result object.
|
<T> reactor.core.publisher.Mono<T> |
queryForObject(String cql,
RowMapper<T> rowMapper)
Execute a query given static CQL, mapping a single result row to a Java object via a
RowMapper . |
<T> reactor.core.publisher.Mono<T> |
queryForObject(String cql,
RowMapper<T> rowMapper,
Object... args)
Query given CQL to create a prepared statement from CQL and a list of arguments to bind to the query, mapping a
single result row to a Java object via a
RowMapper . |
reactor.core.publisher.Mono<ReactiveResultSet> |
queryForResultSet(com.datastax.driver.core.Statement statement)
Execute a query for a ResultSet, given static CQL.
|
reactor.core.publisher.Mono<ReactiveResultSet> |
queryForResultSet(String cql)
Execute a query for a ResultSet, given static CQL.
|
reactor.core.publisher.Mono<ReactiveResultSet> |
queryForResultSet(String cql,
Object... args)
Query given CQL to create a prepared statement from CQL and a list of arguments to bind to the query, expecting a
ResultSet.
|
reactor.core.publisher.Flux<com.datastax.driver.core.Row> |
queryForRows(com.datastax.driver.core.Statement statement)
Execute a query for Rows, given static CQL.
|
reactor.core.publisher.Flux<com.datastax.driver.core.Row> |
queryForRows(String cql)
Execute a query for Rows, given static CQL.
|
reactor.core.publisher.Flux<com.datastax.driver.core.Row> |
queryForRows(String cql,
Object... args)
Query given CQL to create a prepared statement from CQL and a list of arguments to bind to the query, expecting
Rows.
|
<T> reactor.core.publisher.Flux<T> execute(ReactiveSessionCallback<T> action) throws DataAccessException
ReactiveSession
. This allows for implementing arbitrary data access
operations, within Spring's managed CQL environment: that is, converting CQL
DriverException
s into Spring's DataAccessException
hierarchy.
The callback action can return a result object, for example a domain object or a collection of domain objects.
action
- the callback object that specifies the action.DataAccessException
- if there is any problem executing the query.reactor.core.publisher.Mono<Boolean> execute(String cql) throws DataAccessException
cql
- static CQL to execute, must not be empty or null.DataAccessException
- if there is any problem executing the query.<T> reactor.core.publisher.Flux<T> query(String cql, ReactiveResultSetExtractor<T> rse) throws DataAccessException
ReactiveResultSet
with a ReactiveResultSetExtractor
.
Uses a CQL Statement, not a PreparedStatement
. If you want to execute a static query with a
PreparedStatement
, use the overloaded query
method with null as argument array.
cql
- static CQL to execute, must not be empty or null.rse
- object that will extract all rows of results, must not be null.DataAccessException
- if there is any problem executing the query.query(String, ReactiveResultSetExtractor, Object...)
<T> reactor.core.publisher.Flux<T> query(String cql, RowMapper<T> rowMapper) throws DataAccessException
RowMapper
.
Uses a CQL Statement, not a PreparedStatement
. If you want to execute a static query with a
PreparedStatement
, use the overloaded query
method with null as argument array.
cql
- static CQL to execute, must not be empty or null.rowMapper
- object that will map one object per row, must not be null.Flux
, containing mapped objects.DataAccessException
- if there is any problem executing the query.query(String, RowMapper, Object[])
<T> reactor.core.publisher.Mono<T> queryForObject(String cql, RowMapper<T> rowMapper) throws DataAccessException
RowMapper
.
Uses a CQL Statement, not a PreparedStatement
. If you want to execute a static query with a
PreparedStatement
, use the overloaded queryForObject(String, RowMapper, Object...)
method with
null as argument array.
cql
- static CQL to execute, must not be empty or null.rowMapper
- object that will map one object per row, must not be null.IncorrectResultSizeDataAccessException
- if the query does not return exactly one row.DataAccessException
- if there is any problem executing the query.queryForObject(String, RowMapper, Object[])
<T> reactor.core.publisher.Mono<T> queryForObject(String cql, Class<T> requiredType) throws DataAccessException
Uses a CQL Statement, not a PreparedStatement
. If you want to execute a static query with a
PreparedStatement
, use the overloaded queryForObject(String, Class, Object...)
method with
null as argument array.
This method is useful for running static CQL with a known outcome. The query is expected to be a single row/single column query; the returned result will be directly mapped to the corresponding object type.
cql
- static CQL to execute, must not be empty or null.requiredType
- the type that the result object is expected to match, must not be null.Mono.empty()
in case of CQL NULL.IncorrectResultSizeDataAccessException
- if the query does not return exactly one row, or does not return
exactly one column in that row.DataAccessException
- if there is any problem executing the query.queryForObject(String, Class, Object[])
reactor.core.publisher.Mono<Map<String,Object>> queryForMap(String cql) throws DataAccessException
Uses a CQL Statement, not a PreparedStatement
. If you want to execute a static query with a
PreparedStatement
, use the overloaded queryForMap(String, Object...)
method with null
as argument array.
The query is expected to be a single row query; the result row will be mapped to a Map (one entry for each column, using the column name as the key).
cql
- static CQL to execute, must not be empty or null.IncorrectResultSizeDataAccessException
- if the query does not return exactly one row.DataAccessException
- if there is any problem executing the query.queryForMap(String, Object[])
,
ColumnMapRowMapper
<T> reactor.core.publisher.Flux<T> queryForFlux(String cql, Class<T> elementType) throws DataAccessException
Flux
, given static CQL.
Uses a CQL Statement, not a PreparedStatement
. If you want to execute a static query with a
PreparedStatement
, use the overloaded queryForFlux
method with null as argument array.
The results will be mapped to a Flux
(one item for each row) of result objects, each of them matching the
specified element type.
cql
- static CQL to execute, must not be empty or null.elementType
- the required type of element in the result Flux
(for example, Integer.class
),
must not be null.Flux
of objects that match the specified element type.DataAccessException
- if there is any problem executing the query.queryForFlux(String, Class, Object[])
,
SingleColumnRowMapper
reactor.core.publisher.Flux<Map<String,Object>> queryForFlux(String cql) throws DataAccessException
Flux
, given static CQL.
Uses a CQL Statement, not a PreparedStatement
. If you want to execute a static query with a
PreparedStatement
, use the overloaded queryForFlux
method with null as argument array.
The results will be mapped to a Flux
(one item for each row) of Map
s (one entry for each column
using the column name as the key). Each item in the Flux
will be of the form returned by this interface's
queryForMap() methods.
cql
- static CQL to execute, must not be empty or null.Flux
that contains a Map
per row.DataAccessException
- if there is any problem executing the query.queryForFlux(String, Object[])
reactor.core.publisher.Mono<ReactiveResultSet> queryForResultSet(String cql) throws DataAccessException
Uses a CQL Statement, not a PreparedStatement
. If you want to execute a static query with a
PreparedStatement
, use the overloaded queryForResultSet
method with null as argument
array.
The results will be mapped to an ReactiveResultSet
.
cql
- static CQL to execute, must not be empty or null.ReactiveResultSet
representation.DataAccessException
- if there is any problem executing the query.queryForResultSet(String, Object[])
reactor.core.publisher.Flux<com.datastax.driver.core.Row> queryForRows(String cql) throws DataAccessException
Uses a CQL Statement, not a PreparedStatement
. If you want to execute a static query with a
PreparedStatement
, use the overloaded queryForResultSet
method with null as argument
array.
The results will be mapped to Row
s.
cql
- static CQL to execute, must not be empty or null.DataAccessException
- if there is any problem executing the query.queryForResultSet(String, Object[])
reactor.core.publisher.Flux<Boolean> execute(org.reactivestreams.Publisher<String> statementPublisher) throws DataAccessException
Publisher
.statementPublisher
- defining a Publisher
of CQL statements that will be executed.DataAccessException
- if there is any problem executing the batch.reactor.core.publisher.Mono<Boolean> execute(com.datastax.driver.core.Statement statement) throws DataAccessException
statement
- static CQL Statement
, must not be null.DataAccessException
- if there is any problem executing the query.<T> reactor.core.publisher.Flux<T> query(com.datastax.driver.core.Statement statement, ReactiveResultSetExtractor<T> rse) throws DataAccessException
ReactiveResultSet
with a ReactiveResultSetExtractor
.
Uses a CQL Statement, not a PreparedStatement
. If you want to execute a static query with a
PreparedStatement
, use the overloaded query
method with null as argument array.
statement
- static CQL Statement
, must not be null.rse
- object that will extract all rows of results, must not be null.DataAccessException
- if there is any problem executing the query.query(String, ReactiveResultSetExtractor, Object...)
<T> reactor.core.publisher.Flux<T> query(com.datastax.driver.core.Statement statement, RowMapper<T> rowMapper) throws DataAccessException
RowMapper
.
Uses a CQL Statement, not a PreparedStatement
. If you want to execute a static query with a
PreparedStatement
, use the overloaded query
method with null as argument array.
statement
- static CQL Statement
, must not be null.rowMapper
- object that will map one object per row, must not be null.Flux
, containing mapped objects.DataAccessException
- if there is any problem executing the query.query(String, RowMapper, Object[])
<T> reactor.core.publisher.Mono<T> queryForObject(com.datastax.driver.core.Statement statement, RowMapper<T> rowMapper) throws DataAccessException
RowMapper
.
Uses a CQL Statement, not a PreparedStatement
. If you want to execute a static query with a
PreparedStatement
, use the overloaded queryForObject(String, RowMapper, Object...)
method with
null as argument array.
statement
- static CQL Statement
, must not be null.rowMapper
- object that will map one object per row, must not be null.IncorrectResultSizeDataAccessException
- if the query does not return exactly one row.DataAccessException
- if there is any problem executing the query.queryForObject(String, RowMapper, Object[])
<T> reactor.core.publisher.Mono<T> queryForObject(com.datastax.driver.core.Statement statement, Class<T> requiredType) throws DataAccessException
Uses a CQL Statement, not a PreparedStatement
. If you want to execute a static query with a
PreparedStatement
, use the overloaded queryForObject(String, Class, Object...)
method with
null as argument array.
This method is useful for running static CQL with a known outcome. The query is expected to be a single row/single column query; the returned result will be directly mapped to the corresponding object type.
statement
- static CQL Statement
, must not be null.requiredType
- the type that the result object is expected to match, must not be null.Mono.empty()
in case of CQL NULL.IncorrectResultSizeDataAccessException
- if the query does not return exactly one row, or does not return
exactly one column in that row.DataAccessException
- if there is any problem executing the query.queryForObject(String, Class, Object[])
reactor.core.publisher.Mono<Map<String,Object>> queryForMap(com.datastax.driver.core.Statement statement) throws DataAccessException
Uses a CQL Statement, not a PreparedStatement
. If you want to execute a static query with a
PreparedStatement
, use the overloaded queryForMap(String, Object...)
method with null
as argument array.
The query is expected to be a single row query; the result row will be mapped to a Map (one entry for each column, using the column name as the key).
statement
- static CQL Statement
, must not be null.IncorrectResultSizeDataAccessException
- if the query does not return exactly one row.DataAccessException
- if there is any problem executing the query.queryForMap(String, Object[])
,
ColumnMapRowMapper
<T> reactor.core.publisher.Flux<T> queryForFlux(com.datastax.driver.core.Statement statement, Class<T> elementType) throws DataAccessException
Flux
, given static CQL.
Uses a CQL Statement, not a PreparedStatement
. If you want to execute a static query with a
PreparedStatement
, use the overloaded queryForFlux
method with null as argument array.
The results will be mapped to a Flux
(one item for each row) of result objects, each of them matching the
specified element type.
statement
- static CQL Statement
, must not be null.elementType
- the required type of element in the result Flux
(for example, Integer.class
),
must not be null.Flux
of objects that match the specified element type.DataAccessException
- if there is any problem executing the query.queryForFlux(String, Class, Object[])
,
SingleColumnRowMapper
reactor.core.publisher.Flux<Map<String,Object>> queryForFlux(com.datastax.driver.core.Statement statement) throws DataAccessException
Flux
, given static CQL.
Uses a CQL Statement, not a PreparedStatement
. If you want to execute a static query with a
PreparedStatement
, use the overloaded queryForFlux
method with null as argument array.
The results will be mapped to a Flux
(one item for each row) of Map
s (one entry for each column
using the column name as the key). Each item in the Flux
will be of the form returned by this interface's
queryForMap() methods.
statement
- static CQL Statement
, must not be null.Flux
that contains a Map
per row.DataAccessException
- if there is any problem executing the query.queryForFlux(String, Object[])
reactor.core.publisher.Mono<ReactiveResultSet> queryForResultSet(com.datastax.driver.core.Statement statement) throws DataAccessException
Uses a CQL Statement, not a PreparedStatement
. If you want to execute a static query with a
PreparedStatement
, use the overloaded queryForResultSet
method with null as argument
array.
The results will be mapped to an ReactiveResultSet
.
statement
- static CQL Statement
, must not be null.ReactiveResultSet
representation.DataAccessException
- if there is any problem executing the query.queryForResultSet(String, Object[])
reactor.core.publisher.Flux<com.datastax.driver.core.Row> queryForRows(com.datastax.driver.core.Statement statement) throws DataAccessException
Uses a CQL Statement, not a PreparedStatement
. If you want to execute a static query with a
PreparedStatement
, use the overloaded queryForResultSet
method with null as argument
array.
The results will be mapped to Row
s.
statement
- static CQL Statement
, must not be null.DataAccessException
- if there is any problem executing the query.queryForResultSet(String, Object[])
<T> reactor.core.publisher.Flux<T> execute(ReactivePreparedStatementCreator psc, ReactivePreparedStatementCallback<T> action) throws DataAccessException
PreparedStatement
.
This allows for implementing arbitrary data access operations on a single PreparedStatement
, within
Spring's managed CQL environment: that is, participating in Spring-managed transactions and converting CQL
DriverException
s into Spring's DataAccessException
hierarchy.
The callback action can return a result object, for example a domain object or a collection of domain objects.
psc
- object that can create a PreparedStatement
given a
ReactiveSession
, must not be null.action
- callback object that specifies the action, must not be null.DataAccessException
- if there is any problem executing the query.<T> reactor.core.publisher.Flux<T> execute(String cql, ReactivePreparedStatementCallback<T> action) throws DataAccessException
PreparedStatement
.
This allows for implementing arbitrary data access operations on a single Statement, within Spring's managed CQL
environment: that is, participating in Spring-managed transactions and converting CQL
DriverException
s into Spring's DataAccessException
hierarchy.
The callback action can return a result object, for example a domain object or a collection of domain objects.
cql
- static CQL to execute, must not be empty or null.action
- callback object that specifies the action, must not be null.DataAccessException
- if there is any problem executing the query.<T> reactor.core.publisher.Flux<T> query(ReactivePreparedStatementCreator psc, ReactiveResultSetExtractor<T> rse) throws DataAccessException
ReactiveResultSet
with a ReactiveResultSetExtractor
.psc
- object that can create a PreparedStatement
given a
ReactiveSession
, must not be null.rse
- object that will extract results, must not be null.ReactiveResultSetExtractor
DataAccessException
- if there is any problem executing the query.<T> reactor.core.publisher.Flux<T> query(String cql, @Nullable PreparedStatementBinder psb, ReactiveResultSetExtractor<T> rse) throws DataAccessException
ReactiveResultSet
with a ReactiveResultSetExtractor
.cql
- static CQL to execute, must not be empty or null.psb
- object that knows how to set values on the prepared statement. If this is null, the CQL will
be assumed to contain no bind parameters. Even if there are no bind parameters, this object may be used to
set fetch size and other performance options.rse
- object that will extract results, must not be null.ReactiveResultSetExtractor
.DataAccessException
- if there is any problem executing the query.<T> reactor.core.publisher.Flux<T> query(ReactivePreparedStatementCreator psc, @Nullable PreparedStatementBinder psb, ReactiveResultSetExtractor<T> rse) throws DataAccessException
PreparedStatementBinder
implementation that knows how to bind values
to the query, reading the ReactiveResultSet
with a ResultSetExtractor
.psc
- object that can create a PreparedStatement
given a Session
,
must not be null.psb
- object that knows how to set values on the prepared statement. If this is null, the CQL will
be assumed to contain no bind parameters. Even if there are no bind parameters, this object may be used to
set fetch size and other performance options.rse
- object that will extract results, must not be null.ResultSetExtractor
.DataAccessException
- if there is any problem executing the query.<T> reactor.core.publisher.Flux<T> query(String cql, ReactiveResultSetExtractor<T> rse, Object... args) throws DataAccessException
ReactiveResultSet
with a ReactiveResultSetExtractor
.cql
- static CQL to execute, must not be empty or null.rse
- object that will extract results, must not be null.args
- arguments to bind to the query (leaving it to the PreparedStatement
to guess the corresponding
CQL type).ReactiveResultSetExtractor
DataAccessException
- if there is any problem executing the query.<T> reactor.core.publisher.Flux<T> query(ReactivePreparedStatementCreator psc, RowMapper<T> rowMapper) throws DataAccessException
RowMapper
.psc
- object that can create a PreparedStatement
given a
ReactiveSession
, must not be null.rowMapper
- object that will map one object per row, must not be null.Flux
, containing mapped objects.DataAccessException
- if there is any problem executing the query.<T> reactor.core.publisher.Flux<T> query(String cql, @Nullable PreparedStatementBinder psb, RowMapper<T> rowMapper) throws DataAccessException
PreparedStatement
Binder implementation that
knows how to bind values to the query, mapping each row to a Java object via a RowMapper
.cql
- static CQL to execute, must not be empty or null.psb
- object that knows how to set values on the prepared statement. If this is null, the CQL will
be assumed to contain no bind parameters. Even if there are no bind parameters, this object may be used to
set fetch size and other performance options.rowMapper
- object that will map one object per row, must not be null.Flux
, containing mapped objects.DataAccessException
- if there is any problem executing the query.<T> reactor.core.publisher.Flux<T> query(ReactivePreparedStatementCreator psc, @Nullable PreparedStatementBinder psb, RowMapper<T> rowMapper) throws DataAccessException
PreparedStatementBinder
implementation that knows how to bind values
to the query, mapping each row to a Java object via a RowMapper
.psc
- object that can create a PreparedStatement
given a Session
,
must not be null.psb
- object that knows how to set values on the prepared statement. If this is null, the CQL will
be assumed to contain no bind parameters. Even if there are no bind parameters, this object may be used to
set fetch size and other performance options.rowMapper
- object that will map one object per row, must not be null.Flux
, containing mapped objects.DataAccessException
- if there is any problem executing the query.<T> reactor.core.publisher.Flux<T> query(String cql, RowMapper<T> rowMapper, Object... args) throws DataAccessException
RowMapper
.cql
- static CQL to execute, must not be empty or null.rowMapper
- object that will map one object per rowargs
- arguments to bind to the query (leaving it to the PreparedStatement
to guess the corresponding
CQL type)Flux
, containing mapped objectsDataAccessException
- if there is any problem executing the query.<T> reactor.core.publisher.Mono<T> queryForObject(String cql, RowMapper<T> rowMapper, Object... args) throws DataAccessException
RowMapper
.cql
- static CQL to execute, must not be empty or null.rowMapper
- object that will map one object per row, must not be null.args
- arguments to bind to the query (leaving it to the PreparedStatement
to guess the corresponding
CQL type)IncorrectResultSizeDataAccessException
- if the query does not return exactly one row.DataAccessException
- if there is any problem executing the query.<T> reactor.core.publisher.Mono<T> queryForObject(String cql, Class<T> requiredType, Object... args) throws DataAccessException
The query is expected to be a single row/single column query; the returned result will be directly mapped to the corresponding object type.
cql
- static CQL to execute, must not be empty or null.requiredType
- the type that the result object is expected to match, must not be null.args
- arguments to bind to the query (leaving it to the PreparedStatement to guess the corresponding CQL
type)Mono.empty()
in case of CQL NULL.IncorrectResultSizeDataAccessException
- if the query does not return exactly one row, or does not return
exactly one column in that row.DataAccessException
- if there is any problem executing the query.queryForObject(String, Class)
reactor.core.publisher.Mono<Map<String,Object>> queryForMap(String cql, Object... args) throws DataAccessException
The query is expected to be a single row query; the result row will be mapped to a Map (one entry for each column, using the column name as the key).
cql
- static CQL to execute, must not be empty or null.args
- arguments to bind to the query (leaving it to the PreparedStatement
to guess the corresponding
CQL type).IncorrectResultSizeDataAccessException
- if the query does not return exactly one rowDataAccessException
- if there is any problem executing the query.queryForMap(String)
,
ColumnMapRowMapper
<T> reactor.core.publisher.Flux<T> queryForFlux(String cql, Class<T> elementType, Object... args) throws DataAccessException
Flux
.
The results will be mapped to a Flux
(one item for each row) of result objects, each of them matching the
specified element type.
cql
- static CQL to execute, must not be empty or null.elementType
- the required type of element in the result Flux
(for example, Integer.class
),
must not be null.args
- arguments to bind to the query (leaving it to the PreparedStatement
to guess the corresponding
CQL type).Flux
of objects that match the specified element type.DataAccessException
- if there is any problem executing the query.queryForFlux(String, Class)
,
SingleColumnRowMapper
reactor.core.publisher.Flux<Map<String,Object>> queryForFlux(String cql, Object... args) throws DataAccessException
Flux
.
The results will be mapped to a Flux
(one item for each row) of Map
s (one entry for each column,
using the column name as the key). Each item in the Flux
will be of the form returned by this interface's
queryForMap() methods.
cql
- static CQL to execute, must not be empty or null.args
- arguments to bind to the query (leaving it to the PreparedStatement
to guess the corresponding
CQL type).Flux
that contains a Map
per rowDataAccessException
- if there is any problem executing the query.queryForFlux(String)
reactor.core.publisher.Mono<ReactiveResultSet> queryForResultSet(String cql, Object... args) throws DataAccessException
The results will be mapped to an ReactiveResultSet
.
cql
- static CQL to execute, must not be empty or null.args
- arguments to bind to the query (leaving it to the PreparedStatement
to guess the corresponding
CQL type).ReactiveResultSet
representation.DataAccessException
- if there is any problem executing the query.queryForResultSet(String)
reactor.core.publisher.Flux<com.datastax.driver.core.Row> queryForRows(String cql, Object... args) throws DataAccessException
The results will be mapped to Row
s.
cql
- static CQL to execute, must not be empty or null.args
- arguments to bind to the query (leaving it to the PreparedStatement
to guess the corresponding
CQL type).Row
representation.DataAccessException
- if there is any problem executing the query.queryForResultSet(String)
reactor.core.publisher.Mono<Boolean> execute(ReactivePreparedStatementCreator psc) throws DataAccessException
ReactivePreparedStatementCreator
to provide CQL and any required parameters.psc
- object that provides CQL and any necessary parameters, must not be null.DataAccessException
- if there is any problem issuing the execution.reactor.core.publisher.Mono<Boolean> execute(String cql, @Nullable PreparedStatementBinder psb) throws DataAccessException
PreparedStatementBinder
to set bind parameters, with given CQL. Simpler than
using a ReactivePreparedStatementCreator
as this method will create the PreparedStatement
: The
PreparedStatementBinder
just needs to set parameters.cql
- static CQL to execute, must not be empty or null.psb
- object that knows how to set values on the prepared statement. If this is null, the CQL will
be assumed to contain no bind parameters. Even if there are no bind parameters, this object may be used to
set fetch size and other performance options.DataAccessException
- if there is any problem executing the query.reactor.core.publisher.Mono<Boolean> execute(String cql, Object... args) throws DataAccessException
cql
- static CQL to execute, must not be empty or null.args
- arguments to bind to the query (leaving it to the PreparedStatement
to guess the corresponding
CQL type).DataAccessException
- if there is any problem executing the query.reactor.core.publisher.Flux<Boolean> execute(String cql, org.reactivestreams.Publisher<Object[]> args) throws DataAccessException
cql
- static CQL to execute containing bind parameters, must not be empty or null.args
- arguments to bind to the query (leaving it to the PreparedStatement
to guess the corresponding
CQL type).DataAccessException
- if there is any problem executing the query.Copyright © 2011–2020 Pivotal Software, Inc.. All rights reserved.