Example #1
0
        public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken)
        {
            iprot.IncrementRecursionDepth();
            try
            {
                bool   isset_columnName = false;
                bool   isset_typeDesc   = false;
                bool   isset_position   = false;
                TField field;
                await iprot.ReadStructBeginAsync(cancellationToken);

                while (true)
                {
                    field = await iprot.ReadFieldBeginAsync(cancellationToken);

                    if (field.Type == TType.Stop)
                    {
                        break;
                    }

                    switch (field.ID)
                    {
                    case 1:
                        if (field.Type == TType.String)
                        {
                            ColumnName = await iprot.ReadStringAsync(cancellationToken);

                            isset_columnName = true;
                        }
                        else
                        {
                            await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
                        }
                        break;

                    case 2:
                        if (field.Type == TType.Struct)
                        {
                            TypeDesc = new TTypeDesc();
                            await TypeDesc.ReadAsync(iprot, cancellationToken);

                            isset_typeDesc = true;
                        }
                        else
                        {
                            await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
                        }
                        break;

                    case 3:
                        if (field.Type == TType.I32)
                        {
                            Position = await iprot.ReadI32Async(cancellationToken);

                            isset_position = true;
                        }
                        else
                        {
                            await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
                        }
                        break;

                    case 4:
                        if (field.Type == TType.String)
                        {
                            Comment = await iprot.ReadStringAsync(cancellationToken);
                        }
                        else
                        {
                            await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
                        }
                        break;

                    default:
                        await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);

                        break;
                    }

                    await iprot.ReadFieldEndAsync(cancellationToken);
                }

                await iprot.ReadStructEndAsync(cancellationToken);

                if (!isset_columnName)
                {
                    throw new TProtocolException(TProtocolException.INVALID_DATA);
                }
                if (!isset_typeDesc)
                {
                    throw new TProtocolException(TProtocolException.INVALID_DATA);
                }
                if (!isset_position)
                {
                    throw new TProtocolException(TProtocolException.INVALID_DATA);
                }
            }
            finally
            {
                iprot.DecrementRecursionDepth();
            }
        }
Example #2
0
 public TColumnDesc(string columnName, TTypeDesc typeDesc, int position) : this()
 {
     this.ColumnName = columnName;
     this.TypeDesc   = typeDesc;
     this.Position   = position;
 }