Example #1
0
        public void Read(TProtocol iprot)
        {
            bool   isset_sessionId = false;
            TField field;

            iprot.ReadStructBegin();
            while (true)
            {
                field = iprot.ReadFieldBegin();
                if (field.Type == TType.Stop)
                {
                    break;
                }
                switch (field.ID)
                {
                case 1:
                    if (field.Type == TType.Struct)
                    {
                        SessionId = new THandleIdentifier();
                        SessionId.Read(iprot);
                        isset_sessionId = true;
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                default:
                    TProtocolUtil.Skip(iprot, field.Type);
                    break;
                }
                iprot.ReadFieldEnd();
            }
            iprot.ReadStructEnd();
            if (!isset_sessionId)
            {
                throw new TProtocolException(TProtocolException.INVALID_DATA);
            }
        }
Example #2
0
        public void Read(TProtocol iprot)
        {
            bool   isset_operationId   = false;
            bool   isset_operationType = false;
            bool   isset_hasResultSet  = false;
            TField field;

            iprot.ReadStructBegin();
            while (true)
            {
                field = iprot.ReadFieldBegin();
                if (field.Type == TType.Stop)
                {
                    break;
                }
                switch (field.ID)
                {
                case 1:
                    if (field.Type == TType.Struct)
                    {
                        OperationId = new THandleIdentifier();
                        OperationId.Read(iprot);
                        isset_operationId = true;
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 2:
                    if (field.Type == TType.I32)
                    {
                        OperationType       = (TOperationType)iprot.ReadI32();
                        isset_operationType = true;
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 3:
                    if (field.Type == TType.Bool)
                    {
                        HasResultSet       = iprot.ReadBool();
                        isset_hasResultSet = true;
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 4:
                    if (field.Type == TType.Double)
                    {
                        ModifiedRowCount = iprot.ReadDouble();
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                default:
                    TProtocolUtil.Skip(iprot, field.Type);
                    break;
                }
                iprot.ReadFieldEnd();
            }
            iprot.ReadStructEnd();
            if (!isset_operationId)
            {
                throw new TProtocolException(TProtocolException.INVALID_DATA);
            }
            if (!isset_operationType)
            {
                throw new TProtocolException(TProtocolException.INVALID_DATA);
            }
            if (!isset_hasResultSet)
            {
                throw new TProtocolException(TProtocolException.INVALID_DATA);
            }
        }