Search in sources :

Example 6 with ProtocolVersionRegistry

use of com.datastax.oss.driver.internal.core.ProtocolVersionRegistry in project java-driver by datastax.

the class CqlPrepareHandler method toPrepareMessage.

@NonNull
private Prepare toPrepareMessage(PrepareRequest request) {
    ProtocolVersion protocolVersion = context.getProtocolVersion();
    ProtocolVersionRegistry registry = context.getProtocolVersionRegistry();
    CqlIdentifier keyspace = request.getKeyspace();
    if (keyspace != null && !registry.supports(protocolVersion, DefaultProtocolFeature.PER_REQUEST_KEYSPACE)) {
        throw new IllegalArgumentException("Can't use per-request keyspace with protocol " + protocolVersion);
    }
    return new Prepare(request.getQuery(), (keyspace == null) ? null : keyspace.asInternal());
}
Also used : Prepare(com.datastax.oss.protocol.internal.request.Prepare) ProtocolVersion(com.datastax.oss.driver.api.core.ProtocolVersion) ProtocolVersionRegistry(com.datastax.oss.driver.internal.core.ProtocolVersionRegistry) CqlIdentifier(com.datastax.oss.driver.api.core.CqlIdentifier) NonNull(edu.umd.cs.findbugs.annotations.NonNull)

Aggregations

ProtocolVersionRegistry (com.datastax.oss.driver.internal.core.ProtocolVersionRegistry)6 ProtocolVersion (com.datastax.oss.driver.api.core.ProtocolVersion)4 CqlIdentifier (com.datastax.oss.driver.api.core.CqlIdentifier)3 InternalDriverContext (com.datastax.oss.driver.internal.core.context.InternalDriverContext)3 ConsistencyLevel (com.datastax.oss.driver.api.core.ConsistencyLevel)2 BoundStatement (com.datastax.oss.driver.api.core.cql.BoundStatement)2 PreparedStatement (com.datastax.oss.driver.api.core.cql.PreparedStatement)2 SimpleStatement (com.datastax.oss.driver.api.core.cql.SimpleStatement)2 CodecRegistry (com.datastax.oss.driver.api.core.type.codec.registry.CodecRegistry)2 ConsistencyLevelRegistry (com.datastax.oss.driver.internal.core.ConsistencyLevelRegistry)2 Execute (com.datastax.oss.protocol.internal.request.Execute)2 Query (com.datastax.oss.protocol.internal.request.Query)2 ByteBuffer (java.nio.ByteBuffer)2 ContinuousPagingOptions (com.datastax.dse.protocol.internal.request.query.ContinuousPagingOptions)1 DseQueryOptions (com.datastax.dse.protocol.internal.request.query.DseQueryOptions)1 DefaultDriverOption (com.datastax.oss.driver.api.core.config.DefaultDriverOption)1 DriverConfig (com.datastax.oss.driver.api.core.config.DriverConfig)1 DriverExecutionProfile (com.datastax.oss.driver.api.core.config.DriverExecutionProfile)1 BatchStatement (com.datastax.oss.driver.api.core.cql.BatchStatement)1 EndPoint (com.datastax.oss.driver.api.core.metadata.EndPoint)1