Пример #1
0
        public void Read(TProtocol iprot)
        {
            var    isset_columnName = false;
            var    isset_typeDesc   = false;
            var    isset_position   = 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.String)
                    {
                        ColumnName       = iprot.ReadString();
                        isset_columnName = true;
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 2:
                    if (field.Type == TType.Struct)
                    {
                        TypeDesc = new TTypeDesc();
                        TypeDesc.Read(iprot);
                        isset_typeDesc = true;
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 3:
                    if (field.Type == TType.I32)
                    {
                        Position       = iprot.ReadI32();
                        isset_position = true;
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 4:
                    if (field.Type == TType.String)
                    {
                        Comment = iprot.ReadString();
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                default:
                    TProtocolUtil.Skip(iprot, field.Type);
                    break;
                }
                iprot.ReadFieldEnd();
            }
            iprot.ReadStructEnd();
            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);
            }
        }
Пример #2
0
 public TColumnDesc(String columnName, TTypeDesc typeDesc, Int32 position) : this()
 {
     ColumnName = columnName;
     TypeDesc   = typeDesc;
     Position   = position;
 }