public abstract class QueryOptions
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static CBCodec<QueryOptions> |
codec |
static QueryOptions |
DEFAULT |
Constructor and Description |
---|
QueryOptions() |
Modifier and Type | Method and Description |
---|---|
static QueryOptions |
addColumnSpecifications(QueryOptions options,
java.util.List<ColumnSpecification> columnSpecs) |
static QueryOptions |
create(ConsistencyLevel consistency,
java.util.List<java.nio.ByteBuffer> values,
boolean skipMetadata,
int pageSize,
PagingState pagingState,
ConsistencyLevel serialConsistency,
ProtocolVersion version,
java.lang.String keyspace) |
static QueryOptions |
create(ConsistencyLevel consistency,
java.util.List<java.nio.ByteBuffer> values,
boolean skipMetadata,
int pageSize,
PagingState pagingState,
ConsistencyLevel serialConsistency,
ProtocolVersion version,
java.lang.String keyspace,
long timestamp,
int nowInSeconds) |
static QueryOptions |
forInternalCalls(ConsistencyLevel consistency,
java.util.List<java.nio.ByteBuffer> values) |
static QueryOptions |
forInternalCalls(java.util.List<java.nio.ByteBuffer> values) |
static QueryOptions |
forInternalCallsWithNowInSec(int nowInSec,
ConsistencyLevel consistency,
java.util.List<java.nio.ByteBuffer> values) |
static QueryOptions |
forProtocolVersion(ProtocolVersion protocolVersion) |
com.google.common.collect.ImmutableList<ColumnSpecification> |
getColumnSpecifications()
Returns the column specifications for the bound variables (optional operation).
|
abstract ConsistencyLevel |
getConsistency() |
long |
getCoordinatorReadSizeAbortThresholdBytes() |
long |
getCoordinatorReadSizeWarnThresholdBytes() |
Term |
getJsonColumnValue(int bindIndex,
ColumnIdentifier columnName,
java.util.Collection<ColumnMetadata> expectedReceivers)
Returns the term corresponding to column
columnName in the JSON value of bind index bindIndex . |
java.lang.String |
getKeyspace()
The keyspace that this query is bound to, or null if not relevant.
|
int |
getNowInSec(int ifNotSet) |
int |
getNowInSeconds(QueryState state) |
int |
getPageSize()
The pageSize for this query.
|
PagingState |
getPagingState()
The paging state for this query, or null if not relevant.
|
abstract ProtocolVersion |
getProtocolVersion()
The protocol version for the query.
|
ConsistencyLevel |
getSerialConsistency()
Serial consistency for conditional updates.
|
long |
getTimestamp(QueryState state) |
abstract java.util.List<java.nio.ByteBuffer> |
getValues() |
boolean |
hasColumnSpecifications()
Tells whether or not this
QueryOptions contains the column specifications for the bound variables. |
boolean |
isReadThresholdsEnabled() |
QueryOptions |
prepare(java.util.List<ColumnSpecification> specs) |
abstract boolean |
skipMetadata() |
java.lang.String |
toString() |
public static final QueryOptions DEFAULT
public static final CBCodec<QueryOptions> codec
public static QueryOptions forInternalCalls(ConsistencyLevel consistency, java.util.List<java.nio.ByteBuffer> values)
public static QueryOptions forInternalCallsWithNowInSec(int nowInSec, ConsistencyLevel consistency, java.util.List<java.nio.ByteBuffer> values)
public static QueryOptions forInternalCalls(java.util.List<java.nio.ByteBuffer> values)
public static QueryOptions forProtocolVersion(ProtocolVersion protocolVersion)
public static QueryOptions create(ConsistencyLevel consistency, java.util.List<java.nio.ByteBuffer> values, boolean skipMetadata, int pageSize, PagingState pagingState, ConsistencyLevel serialConsistency, ProtocolVersion version, java.lang.String keyspace)
public static QueryOptions create(ConsistencyLevel consistency, java.util.List<java.nio.ByteBuffer> values, boolean skipMetadata, int pageSize, PagingState pagingState, ConsistencyLevel serialConsistency, ProtocolVersion version, java.lang.String keyspace, long timestamp, int nowInSeconds)
public static QueryOptions addColumnSpecifications(QueryOptions options, java.util.List<ColumnSpecification> columnSpecs)
public abstract ConsistencyLevel getConsistency()
public abstract java.util.List<java.nio.ByteBuffer> getValues()
public abstract boolean skipMetadata()
public Term getJsonColumnValue(int bindIndex, ColumnIdentifier columnName, java.util.Collection<ColumnMetadata> expectedReceivers) throws InvalidRequestException
columnName
in the JSON value of bind index bindIndex
.
This is functionally equivalent to:
Json.parseJson(UTF8Type.instance.getSerializer().deserialize(getValues().get(bindIndex)), expectedReceivers).get(columnName)
but this caches the result of parsing the JSON, so that while this might be called for multiple columns on the same bindIndex
value, the underlying JSON value is only parsed/processed once.
Note: this is a bit more involved in CQL specifics than this class generally is, but as we need to cache this per-query and in an object
that is available when we bind values, this is the easiest place to have this.bindIndex
- the index of the bind value that should be interpreted as a JSON value.columnName
- the name of the column we want the value of.expectedReceivers
- the columns expected in the JSON value at index bindIndex
. This is only used when parsing the
json initially and no check is done afterwards. So in practice, any call of this method on the same QueryOptions object and with the same
bindIndx
values should use the same value for this parameter, but this isn't validated in any way.columnName
in the (JSON) bind value at index bindIndex
. This may return null if the
JSON value has no value for this column.InvalidRequestException
public boolean hasColumnSpecifications()
QueryOptions
contains the column specifications for the bound variables.
The column specifications will be present only for prepared statements.
true
this QueryOptions
contains the column specifications for the bound
variables, false
otherwise.public com.google.common.collect.ImmutableList<ColumnSpecification> getColumnSpecifications()
The column specifications will be present only for prepared statements.
Invoke the hasColumnSpecifications()
method before invoking this method in order to ensure that this
QueryOptions
contains the column specifications.
java.lang.UnsupportedOperationException
- If this QueryOptions
does not contains the column
specifications.public int getPageSize()
<= 0
if not relevant for the query.public PagingState getPagingState()
public ConsistencyLevel getSerialConsistency()
public long getTimestamp(QueryState state)
public int getNowInSeconds(QueryState state)
public java.lang.String getKeyspace()
public int getNowInSec(int ifNotSet)
public abstract ProtocolVersion getProtocolVersion()
public boolean isReadThresholdsEnabled()
public long getCoordinatorReadSizeWarnThresholdBytes()
public long getCoordinatorReadSizeAbortThresholdBytes()
public QueryOptions prepare(java.util.List<ColumnSpecification> specs)
public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2009-2022 The Apache Software Foundation