本文整理了Java中com.datastax.driver.core.RegularStatement.hasValues
方法的一些代码示例,展示了RegularStatement.hasValues
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RegularStatement.hasValues
方法的具体详情如下:
包路径:com.datastax.driver.core.RegularStatement
类名称:RegularStatement
方法名:hasValues
[英]Whether or not this statement has values, that is if getValues will return nullor 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:
代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core
/**
* Whether or not this statement has values, that is if {@code getValues} will return {@code null}
* or not.
*
* <p>This method calls {@link #hasValues(CodecRegistry)} with {@link
* ProtocolVersion#NEWEST_SUPPORTED}. Whether you should use this or the other variant depends on
* the type of statement this is called on:
*
* <ul>
* <li>for a {@link SimpleStatement} or {@link SchemaStatement}, the codec registry isn't
* actually needed, so it's always safe to use this method;
* <li>for a {@link 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 {@link BuiltStatement} for
* more explanations on why this is so);
* <li>for a {@link BatchStatement}, use the first rule if it contains no built statements, or
* the second rule otherwise.
* </ul>
*
* @return {@code false} if {@link #getValues} returns {@code null}, {@code true} otherwise.
*/
public boolean hasValues() {
return hasValues(CodecRegistry.DEFAULT_INSTANCE);
}
代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core
/** {@inheritDoc} */
@Override
public ListenableFuture<PreparedStatement> prepareAsync(final RegularStatement statement) {
if (statement.hasValues())
throw new IllegalArgumentException("A statement to prepare should not have values");
final CodecRegistry codecRegistry = getCluster().getConfiguration().getCodecRegistry();
ListenableFuture<PreparedStatement> prepared =
prepareAsync(statement.getQueryString(codecRegistry), statement.getOutgoingPayload());
return GuavaCompatibility.INSTANCE.transform(
prepared,
new Function<PreparedStatement, PreparedStatement>() {
@Override
public PreparedStatement apply(PreparedStatement prepared) {
ProtocolVersion protocolVersion =
getCluster().getConfiguration().getProtocolOptions().getProtocolVersion();
ByteBuffer routingKey = statement.getRoutingKey(protocolVersion, codecRegistry);
if (routingKey != null) prepared.setRoutingKey(routingKey);
if (statement.getConsistencyLevel() != null)
prepared.setConsistencyLevel(statement.getConsistencyLevel());
if (statement.getSerialConsistencyLevel() != null)
prepared.setSerialConsistencyLevel(statement.getSerialConsistencyLevel());
if (statement.isTracing()) prepared.enableTracing();
prepared.setRetryPolicy(statement.getRetryPolicy());
prepared.setOutgoingPayload(statement.getOutgoingPayload());
prepared.setIdempotent(statement.isIdempotent());
return prepared;
}
});
}
代码示例来源:origin: com.facebook.presto.cassandra/cassandra-driver
/**
* Whether or not this statement has values, that is if {@code getValues}
* will return {@code null} or not.
* <p/>
* This method calls {@link #hasValues(CodecRegistry)} with {@link ProtocolVersion#NEWEST_SUPPORTED}.
* Whether you should use this or the other variant depends on the type of statement this is
* called on:
* <ul>
* <li>for a {@link SimpleStatement} or {@link SchemaStatement}, the codec registry isn't
* actually needed, so it's always safe to use this method;</li>
* <li>for a {@link 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 {@link BuiltStatement} for more explanations
* on why this is so);</li>
* <li>for a {@link BatchStatement}, use the first rule if it contains no built statements,
* or the second rule otherwise.</li>
* </ul>
*
* @return {@code false} if {@link #getValues} returns {@code null}, {@code true}
* otherwise.
*/
public boolean hasValues() {
return hasValues(CodecRegistry.DEFAULT_INSTANCE);
}
代码示例来源:origin: com.yugabyte/cassandra-driver-core
/**
* Whether or not this statement has values, that is if {@code getValues}
* will return {@code null} or not.
* <p/>
* This method calls {@link #hasValues(CodecRegistry)} with {@link ProtocolVersion#NEWEST_SUPPORTED}.
* Whether you should use this or the other variant depends on the type of statement this is
* called on:
* <ul>
* <li>for a {@link SimpleStatement} or {@link SchemaStatement}, the codec registry isn't
* actually needed, so it's always safe to use this method;</li>
* <li>for a {@link 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 {@link BuiltStatement} for more explanations
* on why this is so);</li>
* <li>for a {@link BatchStatement}, use the first rule if it contains no built statements,
* or the second rule otherwise.</li>
* </ul>
*
* @return {@code false} if {@link #getValues} returns {@code null}, {@code true}
* otherwise.
*/
public boolean hasValues() {
return hasValues(CodecRegistry.DEFAULT_INSTANCE);
}
代码示例来源:origin: io.prestosql.cassandra/cassandra-driver
/**
* Whether or not this statement has values, that is if {@code getValues}
* will return {@code null} or not.
* <p/>
* This method calls {@link #hasValues(CodecRegistry)} with {@link ProtocolVersion#NEWEST_SUPPORTED}.
* Whether you should use this or the other variant depends on the type of statement this is
* called on:
* <ul>
* <li>for a {@link SimpleStatement} or {@link SchemaStatement}, the codec registry isn't
* actually needed, so it's always safe to use this method;</li>
* <li>for a {@link 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 {@link BuiltStatement} for more explanations
* on why this is so);</li>
* <li>for a {@link BatchStatement}, use the first rule if it contains no built statements,
* or the second rule otherwise.</li>
* </ul>
*
* @return {@code false} if {@link #getValues} returns {@code null}, {@code true}
* otherwise.
*/
public boolean hasValues() {
return hasValues(CodecRegistry.DEFAULT_INSTANCE);
}
代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core
size += CBUtil.sizeOfConsistencyLevel(getConsistencyLevel());
size += QueryFlag.serializedSize(protocolVersion);
if (hasValues()) {
if (usesNamedValues()) {
size += CBUtil.sizeOfNamedValueList(getNamedValues(protocolVersion, codecRegistry));
代码示例来源:origin: com.yugabyte/cassandra-driver-core
/**
* {@inheritDoc}
*/
@Override
public ListenableFuture<PreparedStatement> prepareAsync(final RegularStatement statement) {
if (statement.hasValues())
throw new IllegalArgumentException("A statement to prepare should not have values");
final CodecRegistry codecRegistry = getCluster().getConfiguration().getCodecRegistry();
ListenableFuture<PreparedStatement> prepared = prepareAsync(statement.getQueryString(codecRegistry), statement.getOutgoingPayload());
return Futures.transform(prepared, new Function<PreparedStatement, PreparedStatement>() {
@Override
public PreparedStatement apply(PreparedStatement prepared) {
ProtocolVersion protocolVersion = getCluster().getConfiguration().getProtocolOptions().getProtocolVersion();
ByteBuffer routingKey = statement.getRoutingKey(protocolVersion, codecRegistry);
if (routingKey != null)
prepared.setRoutingKey(routingKey);
if (statement.getConsistencyLevel() != null)
prepared.setConsistencyLevel(statement.getConsistencyLevel());
if (statement.getSerialConsistencyLevel() != null)
prepared.setSerialConsistencyLevel(statement.getSerialConsistencyLevel());
if (statement.isTracing())
prepared.enableTracing();
prepared.setRetryPolicy(statement.getRetryPolicy());
prepared.setOutgoingPayload(statement.getOutgoingPayload());
prepared.setIdempotent(statement.isIdempotent());
return prepared;
}
});
}
代码示例来源:origin: com.facebook.presto.cassandra/cassandra-driver
/**
* {@inheritDoc}
*/
@Override
public ListenableFuture<PreparedStatement> prepareAsync(final RegularStatement statement) {
if (statement.hasValues())
throw new IllegalArgumentException("A statement to prepare should not have values");
final CodecRegistry codecRegistry = getCluster().getConfiguration().getCodecRegistry();
ListenableFuture<PreparedStatement> prepared = prepareAsync(statement.getQueryString(codecRegistry), statement.getOutgoingPayload());
return Futures.transform(prepared, new Function<PreparedStatement, PreparedStatement>() {
@Override
public PreparedStatement apply(PreparedStatement prepared) {
ProtocolVersion protocolVersion = getCluster().getConfiguration().getProtocolOptions().getProtocolVersion();
ByteBuffer routingKey = statement.getRoutingKey(protocolVersion, codecRegistry);
if (routingKey != null)
prepared.setRoutingKey(routingKey);
if (statement.getConsistencyLevel() != null)
prepared.setConsistencyLevel(statement.getConsistencyLevel());
if (statement.getSerialConsistencyLevel() != null)
prepared.setSerialConsistencyLevel(statement.getSerialConsistencyLevel());
if (statement.isTracing())
prepared.enableTracing();
prepared.setRetryPolicy(statement.getRetryPolicy());
prepared.setOutgoingPayload(statement.getOutgoingPayload());
prepared.setIdempotent(statement.isIdempotent());
return prepared;
}
});
}
代码示例来源:origin: io.prestosql.cassandra/cassandra-driver
/**
* {@inheritDoc}
*/
@Override
public ListenableFuture<PreparedStatement> prepareAsync(final RegularStatement statement) {
if (statement.hasValues())
throw new IllegalArgumentException("A statement to prepare should not have values");
final CodecRegistry codecRegistry = getCluster().getConfiguration().getCodecRegistry();
ListenableFuture<PreparedStatement> prepared = prepareAsync(statement.getQueryString(codecRegistry), statement.getOutgoingPayload());
return Futures.transform(prepared, new Function<PreparedStatement, PreparedStatement>() {
@Override
public PreparedStatement apply(PreparedStatement prepared) {
ProtocolVersion protocolVersion = getCluster().getConfiguration().getProtocolOptions().getProtocolVersion();
ByteBuffer routingKey = statement.getRoutingKey(protocolVersion, codecRegistry);
if (routingKey != null)
prepared.setRoutingKey(routingKey);
if (statement.getConsistencyLevel() != null)
prepared.setConsistencyLevel(statement.getConsistencyLevel());
if (statement.getSerialConsistencyLevel() != null)
prepared.setSerialConsistencyLevel(statement.getSerialConsistencyLevel());
if (statement.isTracing())
prepared.enableTracing();
prepared.setRetryPolicy(statement.getRetryPolicy());
prepared.setOutgoingPayload(statement.getOutgoingPayload());
prepared.setIdempotent(statement.isIdempotent());
return prepared;
}
});
}
内容来源于网络,如有侵权,请联系作者删除!