Exemple #1
0
 private GatRowSet BuildThriftRowSet(IGatRowSet rowSet)
 {
     GatRowSet ret = new GatRowSet();
     ret.Columns = new List<GatColumn>();
     foreach (IGatColumn column in rowSet.Columns)
     {
         GatColumn col = new GatColumn();
         col.Name = column.Name;
         col.Ordinal = column.Ordinal;
         col.Type = new GatColumnType();
         col.Type.Type = (Gat.Event.Thrift.GatDataType)(int)column.Type.Type;
         col.Type.TypeName = column.Type.TypeName;
         if (column.Type.Precision.HasValue)
         {
             col.Type.Precision = column.Type.Precision.Value;
         }
         if (column.Type.Scale.HasValue)
         {
             col.Type.Scale = column.Type.Scale.Value;
         }
         ret.Columns.Add(col);
     }
     ret.Rows = new List<GatRow>();
     foreach (IGatRow row in rowSet.Rows)
     {
         GatRow r = new GatRow();
         r.Values = new List<GatValue>();
         foreach (IGatValue value in row.Values)
         {
             GatValue val = new GatValue();
             val.Ordinal = value.Ordinal;
             object valObj = value.GetValue<object>();
             if (valObj != null)
             {
                 val.Value = ByteUtils.ToByteArray(valObj);
             }
             r.Values.Add(val);
         }
     }
     return ret;
 }
Exemple #2
0
        public void Read(TProtocol iprot)
        {
            TField field;

            iprot.ReadStructBegin();
            while (true)
            {
                field = iprot.ReadFieldBegin();
                if (field.Type == TType.Stop)
                {
                    break;
                }
                switch (field.ID)
                {
                case 1:
                    if (field.Type == TType.List)
                    {
                        {
                            Columns = new List <GatColumn>();
                            TList _list4 = iprot.ReadListBegin();
                            for (int _i5 = 0; _i5 < _list4.Count; ++_i5)
                            {
                                GatColumn _elem6 = new GatColumn();
                                _elem6 = new GatColumn();
                                _elem6.Read(iprot);
                                Columns.Add(_elem6);
                            }
                            iprot.ReadListEnd();
                        }
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 2:
                    if (field.Type == TType.List)
                    {
                        {
                            Rows = new List <GatRow>();
                            TList _list7 = iprot.ReadListBegin();
                            for (int _i8 = 0; _i8 < _list7.Count; ++_i8)
                            {
                                GatRow _elem9 = new GatRow();
                                _elem9 = new GatRow();
                                _elem9.Read(iprot);
                                Rows.Add(_elem9);
                            }
                            iprot.ReadListEnd();
                        }
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                default:
                    TProtocolUtil.Skip(iprot, field.Type);
                    break;
                }
                iprot.ReadFieldEnd();
            }
            iprot.ReadStructEnd();
        }
Exemple #3
0
 public void Read(TProtocol iprot)
 {
     TField field;
       iprot.ReadStructBegin();
       while (true)
       {
     field = iprot.ReadFieldBegin();
     if (field.Type == TType.Stop) {
       break;
     }
     switch (field.ID)
     {
       case 1:
     if (field.Type == TType.List) {
       {
         Columns = new List<GatColumn>();
         TList _list4 = iprot.ReadListBegin();
         for( int _i5 = 0; _i5 < _list4.Count; ++_i5)
         {
           GatColumn _elem6 = new GatColumn();
           _elem6 = new GatColumn();
           _elem6.Read(iprot);
           Columns.Add(_elem6);
         }
         iprot.ReadListEnd();
       }
     } else {
       TProtocolUtil.Skip(iprot, field.Type);
     }
     break;
       case 2:
     if (field.Type == TType.List) {
       {
         Rows = new List<GatRow>();
         TList _list7 = iprot.ReadListBegin();
         for( int _i8 = 0; _i8 < _list7.Count; ++_i8)
         {
           GatRow _elem9 = new GatRow();
           _elem9 = new GatRow();
           _elem9.Read(iprot);
           Rows.Add(_elem9);
         }
         iprot.ReadListEnd();
       }
     } else {
       TProtocolUtil.Skip(iprot, field.Type);
     }
     break;
       default:
     TProtocolUtil.Skip(iprot, field.Type);
     break;
     }
     iprot.ReadFieldEnd();
       }
       iprot.ReadStructEnd();
 }