コード例 #1
0
 internal static QueryProtocolOptions CreateFromQuery(Statement query, QueryOptions queryOptions)
 {
     if (query == null)
     {
         return Default;
     }
     var consistency = query.ConsistencyLevel ?? queryOptions.GetConsistencyLevel();
     var pageSize = query.PageSize != 0 ? query.PageSize : queryOptions.GetPageSize();
     var options = new QueryProtocolOptions(
         consistency,
         query.QueryValues,
         query.SkipMetadata, 
         pageSize, 
         query.PagingState, 
         query.SerialConsistencyLevel)
     {
         Timestamp = query.Timestamp
     };
     return options;
 }
コード例 #2
0
 /// <summary>
 /// Adds a new statement to this batch.
 /// Note that statement can be any <c>Statement</c>. It is allowed to mix <see cref="SimpleStatement"/> and <see cref="BoundStatement"/> in the same <c>BatchStatement</c> in particular.
 /// Please note that the options of the added <c>Statement</c> (all those defined directly by the Statement class: consistency level, fetch size, tracing, ...) will be ignored for the purpose of the execution of the Batch. Instead, the options used are the one of this <c>BatchStatement</c> object.
 /// </summary>
 /// <param name="statement">Statement to add to the batch</param>
 /// <returns>The Batch statement</returns>
 /// <exception cref="System.ArgumentOutOfRangeException">Thrown when trying to add more than <c>short.MaxValue</c> Statements</exception>
 public BatchStatement Add(Statement statement)
 {
     if (_queries.Count > short.MaxValue)
     {
         //see BatchMessage.codec field in BatchMessage.java in server code, and BatchRequest.GetFrame in this driver
         throw new ArgumentOutOfRangeException(string.Format("There can be only {0} child statement in a batch statement accordung to the cassandra native protocol", short.MaxValue));
     }
     _queries.Add(statement);
     return this;
 }
コード例 #3
0
 /// <summary>
 /// Adds a new statement to this batch.
 /// Note that statement can be any <c>Statement</c>. It is allowed to mix <see cref="SimpleStatement"/> and <see cref="BoundStatement"/> in the same <c>BatchStatement</c> in particular.
 /// Please note that the options of the added <c>Statement</c> (all those defined directly by the Statement class: consistency level, fetch size, tracing, ...) will be ignored for the purpose of the execution of the Batch. Instead, the options used are the one of this <c>BatchStatement</c> object.
 /// </summary>
 /// <param name="statement">Statement to add to the batch</param>
 /// <returns>The Batch statement</returns>
 public BatchStatement Add(Statement statement)
 {
     _queries.Add(statement);
     return this;
 }
コード例 #4
0
 /// <summary>
 /// Adds a new statement to this batch.
 /// Note that statement can be any <c>Statement</c>. It is allowed to mix <see cref="SimpleStatement"/> and <see cref="BoundStatement"/> in the same <c>BatchStatement</c> in particular.
 /// Please note that the options of the added <c>Statement</c> (all those defined directly by the Statement class: consistency level, fetch size, tracing, ...) will be ignored for the purpose of the execution of the Batch. Instead, the options used are the one of this <c>BatchStatement</c> object.
 /// </summary>
 /// <param name="statement">Statement to add to the batch</param>
 /// <returns>The Batch statement</returns>
 public BatchStatement Add(Statement statement)
 {
     _queries.Add(statement);
     return(this);
 }
コード例 #5
0
 /// <summary>
 /// Returns a new instance with the minimum amount of values, valid to generate a batch request item.
 /// </summary>
 internal static QueryProtocolOptions CreateForBatchItem(Statement statement)
 {
     return(new QueryProtocolOptions(
                ConsistencyLevel.One, statement.QueryValues, false, 0, null, ConsistencyLevel.Serial));
 }
コード例 #6
0
 internal static QueryProtocolOptions CreateFromQuery(Statement query, ConsistencyLevel defaultConsistencyLevel)
 {
     if (query == null)
     {
         return Default;
     }
     var options = new QueryProtocolOptions(
         query.ConsistencyLevel.HasValue ? query.ConsistencyLevel.Value : defaultConsistencyLevel,
         query.QueryValues,
         query.SkipMetadata, query.PageSize, query.PagingState, query.SerialConsistencyLevel)
     {
         Timestamp = query.Timestamp
     };
     return options;
 }