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());
}
Aggregations