public abstract class RegularStatement extends Statement
getValues
). It can be extended but SimpleStatement
is provided as a simple implementation to build a RegularStatement
directly
from its query string.idempotent, NULL_PAYLOAD_VALUE
Modifier | Constructor and Description |
---|---|
protected |
RegularStatement()
Creates a new RegularStatement.
|
Modifier and Type | Method and Description |
---|---|
String |
getQueryString()
Returns the query string for this statement.
|
abstract String |
getQueryString(CodecRegistry codecRegistry)
Returns the query string for this statement.
|
abstract ByteBuffer[] |
getValues(ProtocolVersion protocolVersion,
CodecRegistry codecRegistry)
The values to use for this statement.
|
boolean |
hasValues()
Whether or not this statement has values, that is if
getValues
will return null or not. |
abstract boolean |
hasValues(CodecRegistry codecRegistry)
Whether or not this statement has values, that is if
getValues
will return null or not. |
String |
toString() |
disableTracing, enableTracing, getConsistencyLevel, getDefaultTimestamp, getFetchSize, getKeyspace, getRetryPolicy, getRoutingKey, getSerialConsistencyLevel, isIdempotent, isTracing, setConsistencyLevel, setDefaultTimestamp, setFetchSize, setIdempotent, setOutgoingPayload, setPagingState, setPagingState, setPagingStateUnsafe, setRetryPolicy, setSerialConsistencyLevel
public abstract String getQueryString(CodecRegistry codecRegistry)
codecRegistry
- the codec registry that will be used if the actual
implementation needs to serialize Java objects in the
process of generating the query. Note that it might be
possible to use the no-arg getQueryString()
depending on the type of statement this is called on.getQueryString()
public String getQueryString()
getQueryString(CodecRegistry)
with CodecRegistry.DEFAULT_INSTANCE
.
Whether you should use this or the other variant depends on the type of statement this is
called on:
SimpleStatement
or SchemaStatement
, the codec registry isn't
actually needed, so it's always safe to use this method;BuiltStatement
you can use this method if you use no custom codecs, or if
your custom codecs are registered with the default registry. Otherwise, use the other method and
provide the registry that contains your codecs (see BuiltStatement
for more explanations
on why this is so);BatchStatement
, use the first rule if it contains no built statements,
or the second rule otherwise.public abstract ByteBuffer[] getValues(ProtocolVersion protocolVersion, CodecRegistry codecRegistry)
null
) are not supported with the native protocol version 1: you
will get an UnsupportedProtocolVersionException
when submitting
one if version 1 of the protocol is in use (i.e. if you've force version
1 through Cluster.Builder.withProtocolVersion(com.datastax.driver.core.ProtocolVersion)
or you use
Cassandra 1.2).protocolVersion
- the protocol version that will be used to serialize
the values.codecRegistry
- the codec registry that will be used to serialize the
values.InvalidTypeException
- if one of the values is not of a type
that can be serialized to a CQL3 typeSimpleStatement.SimpleStatement(String, Object...)
public abstract boolean hasValues(CodecRegistry codecRegistry)
getValues
will return null
or not.codecRegistry
- the codec registry that will be used if the actual
implementation needs to serialize Java objects in the
process of determining if the query has values.
Note that it might be possible to use the no-arg
hasValues()
depending on the type of
statement this is called on.false
if getValues(com.datastax.driver.core.ProtocolVersion, com.datastax.driver.core.CodecRegistry)
returns null
, true
otherwise.hasValues()
public boolean hasValues()
getValues
will return null
or not.
This method calls hasValues(CodecRegistry)
with ProtocolVersion.NEWEST_SUPPORTED
.
Whether you should use this or the other variant depends on the type of statement this is
called on:
SimpleStatement
or SchemaStatement
, the codec registry isn't
actually needed, so it's always safe to use this method;BuiltStatement
you can use this method if you use no custom codecs, or if
your custom codecs are registered with the default registry. Otherwise, use the other method and
provide the registry that contains your codecs (see BuiltStatement
for more explanations
on why this is so);BatchStatement
, use the first rule if it contains no built statements,
or the second rule otherwise.false
if getValues(com.datastax.driver.core.ProtocolVersion, com.datastax.driver.core.CodecRegistry)
returns null
, true
otherwise.