public QueryRequest(int protocolVersion, string cqlQuery, bool tracingEnabled, QueryProtocolOptions queryOptions) { //TODO: Replace constructor parameters with IStatement ProtocolVersion = protocolVersion; _cqlQuery = cqlQuery; _queryOptions = queryOptions; if (tracingEnabled) { _headerFlags = FrameHeader.HeaderFlag.Tracing; } if (queryOptions == null) { throw new ArgumentNullException("queryOptions"); } if (Consistency.IsSerialConsistencyLevel()) { throw new RequestInvalidException("Serial consistency specified as a non-serial one."); } if (queryOptions.SerialConsistency != ConsistencyLevel.Any && queryOptions.SerialConsistency.IsSerialConsistencyLevel() == false) { throw new RequestInvalidException("Non-serial consistency specified as a serial one."); } if (protocolVersion < 3) { //Features supported in protocol v3 and above if (queryOptions.Timestamp != null) { throw new NotSupportedException("Timestamp for query is supported in Cassandra 2.1 and above."); } if (queryOptions.ValueNames != null && queryOptions.ValueNames.Count > 0) { throw new NotSupportedException("Query parameter names feature is supported in Cassandra 2.1 and above."); } } }
public ExecuteRequest(int protocolVersion, byte[] id, RowSetMetadata metadata, bool tracingEnabled, QueryProtocolOptions queryOptions) { ProtocolVersion = protocolVersion; if (metadata != null && queryOptions.Values.Length != metadata.Columns.Length) { throw new ArgumentException("Number of values does not match with number of prepared statement markers(?).", "values"); } _id = id; _metadata = metadata; _queryOptions = queryOptions; if (tracingEnabled) { _flags = 0x02; } if (Consistency.IsSerialConsistencyLevel()) { throw new RequestInvalidException("Serial consistency specified as a non-serial one."); } if (queryOptions.SerialConsistency != ConsistencyLevel.Any && queryOptions.SerialConsistency.IsSerialConsistencyLevel() == false) { throw new RequestInvalidException("Non-serial consistency specified as a serial one."); } if (queryOptions.Timestamp != null && protocolVersion < 3) { throw new NotSupportedException("Timestamp for query is supported in Cassandra 2.1 or above."); } }