Example #1
0
        internal ResultResponse(Frame frame) : base(frame)
        {
            Kind = (ResultResponseKind)Reader.ReadInt32();
            switch (Kind)
            {
            case ResultResponseKind.Void:
                Output = new OutputVoid(TraceId);
                break;

            case ResultResponseKind.Rows:
                var outputRows = new OutputRows(Reader, frame.ResultMetadata, TraceId);
                Output = outputRows;
                if (outputRows.ResultRowsMetadata.HasNewResultMetadataId())
                {
                    NewResultMetadata = new ResultMetadata(
                        outputRows.ResultRowsMetadata.NewResultMetadataId, outputRows.ResultRowsMetadata);
                }
                break;

            case ResultResponseKind.SetKeyspace:
                Output = new OutputSetKeyspace(Reader.ReadString());
                break;

            case ResultResponseKind.Prepared:
                Output = new OutputPrepared(frame.Header.Version, Reader);
                break;

            case ResultResponseKind.SchemaChange:
                Output = new OutputSchemaChange(frame.Header.Version, Reader, TraceId);
                break;

            default:
                throw new DriverInternalError("Unknown ResultResponseKind Type");
            }
        }
Example #2
0
        internal ResultResponse(Frame frame)
            : base(frame)
        {
            //Handle result flags
            if ((frame.Header.Flags & FrameHeader.HeaderFlag.Warning) != 0)
            {
                Warnings = Reader.ReadStringList();
            }
            if ((frame.Header.Flags &FrameHeader.HeaderFlag.CustomPayload) != 0)
            {
                CustomPayload = Reader.ReadBytesMap();
            }

            Kind = (ResultResponseKind) Reader.ReadInt32();
            switch (Kind)
            {
                case ResultResponseKind.Void:
                    Output = new OutputVoid(TraceId);
                    break;
                case ResultResponseKind.Rows:
                    Output = new OutputRows(Reader, TraceId);
                    break;
                case ResultResponseKind.SetKeyspace:
                    Output = new OutputSetKeyspace(Reader.ReadString());
                    break;
                case ResultResponseKind.Prepared:
                    Output = new OutputPrepared(frame.Header.Version, Reader);
                    break;
                case ResultResponseKind.SchemaChange:
                    Output = new OutputSchemaChange(Reader, TraceId);
                    break;
                default:
                    throw new DriverInternalError("Unknown ResultResponseKind Type");
            }
        }