Beispiel #1
0
 /// <summary>
 ///  Creates a new <c>BoundStatement</c> from the provided prepared
 ///  statement.
 /// </summary>
 /// <param name="statement"> the prepared statement from which to create a <c>BoundStatement</c>.</param>
 public BoundStatement(PreparedStatement statement)
 {
     _preparedStatement = statement;
     _routingKey = statement.RoutingKey;
     SetConsistencyLevel(statement.ConsistencyLevel);
     if (statement.IsIdempotent != null)
     {
         SetIdempotence(statement.IsIdempotent.Value);
     }
 }
 /// <summary>
 ///  Set the routing key for this query. <p> This method allows to manually
 ///  provide a routing key for this query. It is thus optional since the routing
 ///  key is only an hint for token aware load balancing policy but is never
 ///  mandatory. </p><p> If the partition key for the query is composite, use the
 ///  <link>#setRoutingKey(ByteBuffer...)</link> method instead to build the
 ///  routing key.</p>
 /// </summary>
 /// <param name="routingKeyComponents"> the raw (binary) values to compose to
 ///  obtain the routing key.
 ///  </param>
 /// <returns>this <c>SimpleStatement</c> object.  <see>Query#getRoutingKey</see></returns>
 public SimpleStatement SetRoutingKey(params RoutingKey[] routingKeyComponents)
 {
     _routingKey = RoutingKey.Compose(routingKeyComponents);
     return this;
 }
 /// <summary>
 ///  Creates a new <c>BoundStatement</c> from the provided prepared
 ///  statement.
 /// </summary>
 /// <param name="statement"> the prepared statement from which to create a <c>BoundStatement</c>.</param>
 public BoundStatement(PreparedStatement statement)
 {
     _preparedStatement = statement;
     _routingKey = statement.RoutingKey;
     SetConsistencyLevel(statement.ConsistencyLevel);
 }
 internal void CalculateRoutingKey(bool useNamedParameters, int[] routingIndexes, string[] routingNames, object[] valuesByPosition, object[] rawValues)
 {
     if (_routingKey != null)
     {
         //The routing key was specified by the user
         return;
     }
     if (routingIndexes != null)
     {
         var keys = new RoutingKey[routingIndexes.Length];
         for (var i = 0; i < routingIndexes.Length; i++)
         {
             var index = routingIndexes[i];
             var key = TypeCodec.Encode(ProtocolVersion, valuesByPosition[index]);
             if (key == null)
             {
                 //The partition key can not be null
                 //Get out and let any node reply a Response Error
                 return;
             }
             keys[i] = new RoutingKey(key);
         }
         SetRoutingKey(keys);
         return;
     }
     if (routingNames != null && useNamedParameters)
     {
         var keys = new RoutingKey[routingNames.Length];
         var routingValues = Utils.GetValues(routingNames, rawValues[0]).ToArray();
         if (routingValues.Length != keys.Length)
         {
             //The routing names are not valid
             return;
         }
         for (var i = 0; i < routingValues.Length; i++)
         {
             var key = TypeCodec.Encode(ProtocolVersion, routingValues[i]);
             if (key == null)
             {
                 //The partition key can not be null
                 return;
             }
             keys[i] = new RoutingKey(key);
         }
         SetRoutingKey(keys);
     }
 }
 /// <summary>
 ///  Creates a new <c>BoundStatement</c> from the provided prepared
 ///  statement.
 /// </summary>
 /// <param name="statement"> the prepared statement from which to create a <c>BoundStatement</c>.</param>
 public BoundStatement(PreparedStatement statement)
 {
     _statement = statement;
     _routingKey = statement.RoutingKey;
 }
 /// <summary>
 ///  Set the routing key for this query. This method allows to manually
 ///  provide a routing key for this BoundStatement. It is thus optional since the routing
 ///  key is only an hint for token aware load balancing policy but is never
 ///  mandatory.
 /// </summary>
 /// <param name="routingKeyComponents"> the raw (binary) values to compose the routing key.</param>
 public BoundStatement SetRoutingKey(params RoutingKey[] routingKeyComponents)
 {
     this._routingKey = RoutingKey.Compose(routingKeyComponents);
     return this;
 }
 /// <summary>
 ///  Creates a new <c>BoundStatement</c> from the provided prepared
 ///  statement.
 /// </summary>
 /// <param name="statement"> the prepared statement from which to create a <c>BoundStatement</c>.</param>
 public BoundStatement(PreparedStatement statement)
 {
     _statement  = statement;
     _routingKey = statement.RoutingKey;
 }
Beispiel #8
0
 /// <summary>
 ///  Set the routing key for this query. This method allows to manually
 ///  provide a routing key for this BoundStatement. It is thus optional since the routing
 ///  key is only an hint for token aware load balancing policy but is never
 ///  mandatory.
 /// </summary>
 /// <param name="routingKeyComponents"> the raw (binary) values to compose the routing key.</param>
 public BoundStatement SetRoutingKey(params RoutingKey[] routingKeyComponents)
 {
     _routingKey = RoutingKey.Compose(routingKeyComponents);
     return(this);
 }
Beispiel #9
0
 /// <summary>
 ///  Set the routing key for this query. <p> This method allows to manually
 ///  provide a routing key for this query. It is thus optional since the routing
 ///  key is only an hint for token aware load balancing policy but is never
 ///  mandatory. </p><p> If the partition key for the query is composite, use the
 ///  <link>#setRoutingKey(ByteBuffer...)</link> method instead to build the
 ///  routing key.</p>
 /// </summary>
 /// <param name="routingKeyComponents"> the raw (binary) values to compose to
 ///  obtain the routing key.
 ///  </param>
 ///
 /// <returns>this <code>SimpleStatement</code> object. <see>Query#getRoutingKey</see></returns>
 public SimpleStatement SetRoutingKey(params RoutingKey[] routingKeyComponents)
 {
     this._routingKey = RoutingKey.Compose(routingKeyComponents); return(this);
 }