예제 #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);
        }
예제 #2
0
 public ThriftRowSet(GatRowSet rowSet)
 {
     _rowSet = rowSet;
 }