Beispiel #1
0
        private Common.DataReader.ReaderResultSet ConvertToReaderResult(Common.Protobuf.ReaderResultSet readerResultSetProto)
        {
            if (readerResultSetProto == null)
            {
                return(null);
            }
            Common.DataReader.ReaderResultSet readerResultSet = new Common.DataReader.ReaderResultSet();
            readerResultSet.IsGrouped   = readerResultSetProto.isGrouped;
            readerResultSet.NodeAddress = readerResultSetProto.nodeAddress;
            readerResultSet.NextIndex   = readerResultSetProto.nextIndex;
            readerResultSet.ReaderID    = readerResultSetProto.readerId;

            Common.DataReader.RecordSet recordSet = null;
            if (readerResultSetProto.recordSet != null)
            {
                recordSet = new Common.DataReader.RecordSet();
                RecordSet recordSetProto = readerResultSetProto.recordSet;
                foreach (RecordColumn columnProto in recordSetProto.columns)
                {
                    Common.DataReader.RecordColumn column = new Common.DataReader.RecordColumn(columnProto.name);
                    column.AggregateFunctionType = (Common.Enum.AggregateFunctionType)Convert.ToInt32(columnProto.aggregateFunctionType);
                    column.ColumnType            = (Common.Enum.ColumnType)Convert.ToInt32(columnProto.columnType);
                    column.DataType = (Common.Enum.ColumnDataType)Convert.ToInt32(columnProto.dataType);
                    column.IsFilled = columnProto.isFilled;
                    column.IsHidden = columnProto.isHidden;
                    recordSet.AddColumn(column);
                }

                PopulateRows(recordSet, recordSetProto.rows);
            }
            readerResultSet.RecordSet = recordSet;
            return(readerResultSet);
        }
Beispiel #2
0
        private Common.DataReader.ReaderResultSet ConvertToReaderResult(
            Common.Protobuf.ReaderResultSet readerResultSetProto)
        {
            if (readerResultSetProto == null)
            {
                return(null);
            }
            Common.DataReader.ReaderResultSet readerResultSet = new Common.DataReader.ReaderResultSet();
            readerResultSet.IsGrouped   = readerResultSetProto.isGrouped;
            readerResultSet.NodeAddress = readerResultSetProto.nodeAddress;
            readerResultSet.NextIndex   = readerResultSetProto.nextIndex;
            readerResultSet.ReaderID    = readerResultSetProto.readerId;

            List <Common.Queries.OrderByArgument> orderByArgs = new List <Common.Queries.OrderByArgument>();

            foreach (Common.Protobuf.OrderByArgument obaProto in readerResultSetProto.orderByArguments)
            {
                Common.Queries.OrderByArgument arg = new Common.Queries.OrderByArgument();
                arg.AttributeName = obaProto.attributeName;
                arg.Order         = (Common.Queries.Order)Convert.ToInt32(obaProto.order);
                orderByArgs.Add(arg);
            }

            readerResultSet.OrderByArguments = orderByArgs;
            Common.DataReader.RecordSet recordSet = null;
            if (readerResultSetProto.recordSet != null)
            {
                recordSet = new Common.DataReader.RecordSet();
                Common.Protobuf.RecordSet recordSetProto = readerResultSetProto.recordSet;
                foreach (Common.Protobuf.RecordColumn columnProto in recordSetProto.columns)
                {
                    Common.DataReader.RecordColumn column = new Common.DataReader.RecordColumn(columnProto.name);
                    column.AggregateFunctionType =
                        (Common.Enum.AggregateFunctionType)Convert.ToInt32(columnProto.aggregateFunctionType);
                    column.ColumnType = (Common.Enum.ColumnType)Convert.ToInt32(columnProto.columnType);
                    column.DataType   = (Common.Enum.ColumnDataType)Convert.ToInt32(columnProto.dataType);
                    column.IsFilled   = columnProto.isFilled;
                    column.IsHidden   = columnProto.isHidden;
                    recordSet.AddColumn(column);
                }

                PopulateRows(recordSet, recordSetProto.rows);
            }

            readerResultSet.RecordSet = recordSet;
            return(readerResultSet);
        }