public CassandraCqlRowSchema(CqlResult result, string familyName)
		{
#if DEBUG
			_def = result.Schema;
#endif

			var def = result.Schema;
			var colNameType = CassandraType.GetCassandraType(def.Default_name_type);
			var colValueType = CassandraType.GetCassandraType(def.Default_value_type);

			FamilyName = familyName;
			DefaultColumnNameType = colNameType;
			DefaultColumnValueType = colValueType;
			Columns = new List<CassandraColumnSchema>();

			var colNameTypes = new Dictionary<CassandraObject, CassandraType>();

			foreach (var c in def.Name_types)
			{
				var type = CassandraType.GetCassandraType(c.Value);
				var name = CassandraObject.GetCassandraObjectFromDatabaseByteArray(c.Key, CassandraType.BytesType);

				colNameTypes.Add(name, type);
			}

			// columns returned
			foreach (var c in def.Value_types)
			{
				var type = CassandraType.GetCassandraType(c.Value);
				var nameType = colNameType;
				var name = CassandraObject.GetCassandraObjectFromDatabaseByteArray(c.Key, CassandraType.BytesType);

				if (colNameTypes.ContainsKey(name))
					nameType = colNameTypes[name];

				var colSchema = new CassandraColumnSchema {
					NameType = nameType,
					Name = name,
					ValueType = type
				};

				Columns.Add(colSchema);
			}
		}
Пример #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.I32) {
           Type = (CqlResultType)iprot.ReadI32();
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 2:
         if (field.Type == TType.List) {
           {
             Rows = new List<CqlRow>();
             TList _list83 = iprot.ReadListBegin();
             for( int _i84 = 0; _i84 < _list83.Count; ++_i84)
             {
               CqlRow _elem85 = new CqlRow();
               _elem85 = new CqlRow();
               _elem85.Read(iprot);
               Rows.Add(_elem85);
             }
             iprot.ReadListEnd();
           }
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 3:
         if (field.Type == TType.I32) {
           Num = iprot.ReadI32();
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 4:
         if (field.Type == TType.Struct) {
           Schema = new CqlMetadata();
           Schema.Read(iprot);
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       default: 
         TProtocolUtil.Skip(iprot, field.Type);
         break;
     }
     iprot.ReadFieldEnd();
   }
   iprot.ReadStructEnd();
 }
Пример #3
0
 public void Read (TProtocol iprot)
 {
   bool isset_type = 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.I32) {
           Type = (CqlResultType)iprot.ReadI32();
           isset_type = true;
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 2:
         if (field.Type == TType.List) {
           {
             Rows = new List<CqlRow>();
             TList _list96 = iprot.ReadListBegin();
             for( int _i97 = 0; _i97 < _list96.Count; ++_i97)
             {
               CqlRow _elem98 = new CqlRow();
               _elem98 = new CqlRow();
               _elem98.Read(iprot);
               Rows.Add(_elem98);
             }
             iprot.ReadListEnd();
           }
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 3:
         if (field.Type == TType.I32) {
           Num = iprot.ReadI32();
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 4:
         if (field.Type == TType.Struct) {
           Schema = new CqlMetadata();
           Schema.Read(iprot);
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       default: 
         TProtocolUtil.Skip(iprot, field.Type);
         break;
     }
     iprot.ReadFieldEnd();
   }
   iprot.ReadStructEnd();
   if (!isset_type)
     throw new TProtocolException(TProtocolException.INVALID_DATA);
 }
Пример #4
0
        public void Read(TProtocol iprot)
        {
            bool   isset_type = 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.I32)
                    {
                        Type       = (CqlResultType)iprot.ReadI32();
                        isset_type = true;
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

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

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

                case 4:
                    if (field.Type == TType.Struct)
                    {
                        Schema = new CqlMetadata();
                        Schema.Read(iprot);
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                default:
                    TProtocolUtil.Skip(iprot, field.Type);
                    break;
                }
                iprot.ReadFieldEnd();
            }
            iprot.ReadStructEnd();
            if (!isset_type)
            {
                throw new TProtocolException(TProtocolException.INVALID_DATA);
            }
        }
Пример #5
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.I32)
                    {
                        Type = (CqlResultType)iprot.ReadI32();
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

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

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

                case 4:
                    if (field.Type == TType.Struct)
                    {
                        Schema = new CqlMetadata();
                        Schema.Read(iprot);
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                default:
                    TProtocolUtil.Skip(iprot, field.Type);
                    break;
                }
                iprot.ReadFieldEnd();
            }
            iprot.ReadStructEnd();
        }