Exemple #1
0
        public int WriteFrame(short streamId, MemoryStream stream, ISerializer serializer)
        {
            var wb = new FrameWriter(stream, serializer);

            wb.WriteFrameHeader((byte)_headerFlags, streamId, OpCode);
            var protocolVersion = serializer.ProtocolVersion;

            if (_payload != null)
            {
                wb.WriteBytesMap(_payload);
            }

            wb.WriteLongString(Query);

            if (protocolVersion.SupportsKeyspaceInRequest())
            {
                wb.WriteInt32((int)_prepareFlags);
                if (Keyspace != null)
                {
                    wb.WriteString(Keyspace);
                }
            }

            return(wb.Close());
        }
        public int WriteFrame(short streamId, MemoryStream stream, ISerializer serializer)
        {
            var wb = new FrameWriter(stream, serializer);
            var protocolVersion = serializer.ProtocolVersion;

            if (Payload != null)
            {
                _headerFlags |= FrameHeader.HeaderFlag.CustomPayload;
            }
            wb.WriteFrameHeader((byte)_headerFlags, streamId, OpCode);
            if (Payload != null)
            {
                //A custom payload for this request
                wb.WriteBytesMap(Payload);
            }
            wb.WriteShortBytes(_id);

            if (protocolVersion.SupportsResultMetadataId())
            {
                wb.WriteShortBytes(_resultMetadataId);
            }

            _queryOptions.Write(wb, true);
            return(wb.Close());
        }
 public int WriteFrame(short streamId, MemoryStream stream, Serializer serializer)
 {
     var wb = new FrameWriter(stream, serializer);
     wb.WriteFrameHeader((byte)_headerFlags, streamId, OpCode);
     if (Payload != null)
     {
         wb.WriteBytesMap(Payload);
     }
     wb.WriteLongString(Query);
     return wb.Close();
 }
        public int WriteFrame(short streamId, MemoryStream stream, Serializer serializer)
        {
            var wb = new FrameWriter(stream, serializer);

            wb.WriteFrameHeader((byte)_headerFlags, streamId, OpCode);
            if (Payload != null)
            {
                wb.WriteBytesMap(Payload);
            }
            wb.WriteLongString(Query);
            return(wb.Close());
        }
Exemple #5
0
        public int WriteFrame(short streamId, MemoryStream stream, ISerializer serializer)
        {
            //protocol v2: <type><n><query_1>...<query_n><consistency>
            //protocol v3: <type><n><query_1>...<query_n><consistency><flags>[<serial_consistency>][<timestamp>]
            var protocolVersion = serializer.ProtocolVersion;
            var wb = new FrameWriter(stream, serializer);

            if (Payload != null)
            {
                _headerFlags |= FrameHeader.HeaderFlag.CustomPayload;
            }
            wb.WriteFrameHeader((byte)_headerFlags, streamId, OpCode);
            if (Payload != null)
            {
                //A custom payload for this request
                wb.WriteBytesMap(Payload);
            }
            wb.WriteByte((byte)_type);
            wb.WriteUInt16((ushort)_requests.Count);
            foreach (var br in _requests)
            {
                br.WriteToBatch(wb);
            }
            wb.WriteUInt16((ushort)Consistency);
            if (protocolVersion.SupportsTimestamp())
            {
                if (protocolVersion.Uses4BytesQueryFlags())
                {
                    wb.WriteInt32((int)_batchFlags);
                }
                else
                {
                    wb.WriteByte((byte)_batchFlags);
                }

                wb.WriteUInt16((ushort)SerialConsistency);

                if (_timestamp != null)
                {
                    wb.WriteLong(_timestamp.Value);
                }

                if (_keyspace != null)
                {
                    wb.WriteString(_keyspace);
                }
            }
            return(wb.Close());
        }
Exemple #6
0
        public int WriteFrame(short streamId, MemoryStream stream, ISerializer connectionSerializer)
        {
            var wb = new FrameWriter(stream, Serializer ?? connectionSerializer);

            WriteFrameHeader(wb, streamId);

            if (Payload != null)
            {
                //A custom payload for this request
                wb.WriteBytesMap(Payload);
            }

            WriteBody(wb);

            return(wb.Close());
        }
        public int WriteFrame(short streamId, MemoryStream stream, Serializer serializer)
        {
            var wb = new FrameWriter(stream, serializer);

            if (Payload != null)
            {
                _headerFlags |= FrameHeader.HeaderFlag.CustomPayload;
            }
            wb.WriteFrameHeader((byte)_headerFlags, streamId, OpCode);
            if (Payload != null)
            {
                //A custom payload for this request
                wb.WriteBytesMap(Payload);
            }
            wb.WriteLongString(_cqlQuery);
            _queryOptions.Write(wb, false);
            return(wb.Close());
        }
Exemple #8
0
        public int WriteFrame(short streamId, MemoryStream stream)
        {
            var wb = new FrameWriter(stream);

            if (Payload != null)
            {
                _headerFlags |= FrameHeader.HeaderFlag.CustomPayload;
            }
            wb.WriteFrameHeader((byte)ProtocolVersion, (byte)_headerFlags, streamId, OpCode);
            if (Payload != null)
            {
                //A custom payload for this request
                wb.WriteBytesMap(Payload);
            }
            wb.WriteShortBytes(_id);
            _queryOptions.Write(wb, (byte)ProtocolVersion, true);
            return(wb.Close());
        }
        public int WriteFrame(short streamId, MemoryStream stream, Serializer serializer)
        {
            //protocol v2: <type><n><query_1>...<query_n><consistency>
            //protocol v3: <type><n><query_1>...<query_n><consistency><flags>[<serial_consistency>][<timestamp>]
            var protocolVersion = serializer.ProtocolVersion;
            var wb = new FrameWriter(stream, serializer);

            if (Payload != null)
            {
                _headerFlags |= FrameHeader.HeaderFlag.CustomPayload;
            }
            wb.WriteFrameHeader((byte)_headerFlags, streamId, OpCode);
            if (Payload != null)
            {
                //A custom payload for this request
                wb.WriteBytesMap(Payload);
            }
            wb.WriteByte((byte)_type);
            wb.WriteInt16((short)_requests.Count);
            foreach (var br in _requests)
            {
                br.WriteToBatch(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(TypeSerializer.SinceUnixEpoch(_timestamp.Value).Ticks / 10);
            }
            return(wb.Close());
        }
 public int WriteFrame(short streamId, MemoryStream stream)
 {
     var wb = new FrameWriter(stream);
     if (Payload != null)
     {
         _headerFlags |= FrameHeader.HeaderFlag.CustomPayload;
     }
     wb.WriteFrameHeader((byte)ProtocolVersion, (byte)_headerFlags, streamId, OpCode);
     if (Payload != null)
     {
         //A custom payload for this request
         wb.WriteBytesMap(Payload);
     }
     wb.WriteShortBytes(_id);
     _queryOptions.Write(wb, (byte)ProtocolVersion, true);
     return wb.Close();
 }
 public int WriteFrame(short streamId, MemoryStream stream)
 {
     //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 FrameWriter(stream);
     if (Payload != null)
     {
         _headerFlags |= FrameHeader.HeaderFlag.CustomPayload;
     }
     wb.WriteFrameHeader((byte)ProtocolVersion, (byte)_headerFlags, streamId, OpCode);
     if (Payload != null)
     {
         //A custom payload for this request
         wb.WriteBytesMap(Payload);
     }
     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.Close();
 }
Exemple #12
0
 public int WriteFrame(short streamId, MemoryStream stream, Serializer serializer)
 {
     var wb = new FrameWriter(stream, serializer);
     if (Payload != null)
     {
         _headerFlags |= FrameHeader.HeaderFlag.CustomPayload;
     }
     wb.WriteFrameHeader((byte)_headerFlags, streamId, OpCode);
     if (Payload != null)
     {
         //A custom payload for this request
         wb.WriteBytesMap(Payload);
     }
     wb.WriteLongString(_cqlQuery);
     _queryOptions.Write(wb, false);
     return wb.Close();
 }