コード例 #1
0
 public void WriteToBatch(byte protocolVersion, BEBinaryWriter wb)
 {
     //not a prepared query
     wb.WriteByte(0);
     wb.WriteLongString(_cqlQuery);
     if (_queryOptions.Values == null || _queryOptions.Values.Length == 0)
     {
         //not values
         wb.WriteInt16(0);
     }
     else
     {
         wb.WriteUInt16((ushort)_queryOptions.Values.Length);
         for (var i = 0; i < _queryOptions.Values.Length; i++)
         {
             var bytes = TypeCodec.Encode(protocolVersion, _queryOptions.Values[i]);
             wb.WriteBytes(bytes);
         }
     }
 }
コード例 #2
0
 public RequestFrame GetFrame(short streamId)
 {
     //protocol v2: <type><n><query_1>...<query_n><consistency>
     //protocol v3: <type><n><query_1>...<query_n><consistency><flags>[<serial_consistency>][<timestamp>]
     var wb = new BEBinaryWriter();
     wb.WriteFrameHeader((byte)ProtocolVersion, _headerFlags, streamId, OpCode);
     wb.WriteByte((byte) _type);
     wb.WriteInt16((short) _requests.Count);
     foreach (var br in _requests)
     {
         br.WriteToBatch((byte)ProtocolVersion, wb);
     }
     wb.WriteInt16((short) Consistency);
     if (ProtocolVersion >= 3)
     {
         wb.WriteByte((byte)_batchFlags);
     }
     if (_serialConsistency != null)
     {
         wb.WriteInt16((short)_serialConsistency.Value);
     }
     if (_timestamp != null)
     {
         //Expressed in microseconds
         wb.WriteLong(TypeCodec.ToUnixTime(_timestamp.Value).Ticks / 10);
     }
     return wb.GetFrame();
 }
コード例 #3
0
 public void WriteToBatch(byte protocolVersion, BEBinaryWriter wb)
 {
     //not a prepared query
     wb.WriteByte(0);
     wb.WriteLongString(_cqlQuery);
     if (_queryOptions.Values == null || _queryOptions.Values.Length == 0)
     {
         //not values
         wb.WriteInt16(0);
     }
     else
     {
         wb.WriteUInt16((ushort) _queryOptions.Values.Length);
         for (var i = 0; i < _queryOptions.Values.Length; i++)
         {
             var bytes = TypeCodec.Encode(protocolVersion, _queryOptions.Values[i]);
             wb.WriteBytes(bytes);
         }
     }
 }