Exemplo n.º 1
0
        private static Column[] ParseColumns(OtpInputStream s)
        {
            int colNameCount = s.ReadListHead();

            string[] columnNames = new string[colNameCount];
            for (int i = 0; i < colNameCount; i++)
            {
                columnNames[i] = s.ReadBinaryAsString();
            }

            if (colNameCount > 0)
            {
                s.ReadNil();
            }

            int colTypeCount = s.ReadListHead();

            ColumnType[] columnTypes = new ColumnType[colTypeCount];
            for (int i = 0; i < colTypeCount; i++)
            {
                string a = s.ReadAtom();
                columnTypes[i] = (ColumnType)Enum.Parse(typeof(ColumnType), a, true);
            }

            if (colTypeCount > 0)
            {
                s.ReadNil();
            }

            return(columnNames.Zip(columnTypes, (cname, ctype) => new Column(cname, ctype)).ToArray());
        }
Exemplo n.º 2
0
        private static Row[] ParseRows(OtpInputStream s, Column[] cols)
        {
            int rowCount = s.ReadListHead();

            Row[] rows = new Row[rowCount];
            for (int i = 0; i < rowCount; i++)
            {
                rows[i] = ParseRow(s, cols);
            }

            if (rowCount > 0)
            {
                s.ReadNil();
            }

            return(rows);
        }
Exemplo n.º 3
0
        private static Row[] ParseRows(OtpInputStream s, Column[] cols)
        {
            int rowCount = s.ReadListHead();
            Row[] rows = new Row[rowCount];
            for (int i = 0; i < rowCount; i++)
            {
                rows[i] = ParseRow(s, cols);
            }

            if (rowCount > 0)
            {
                s.ReadNil();
            }

            return rows;
        }
Exemplo n.º 4
0
        private static Column[] ParseColumns(OtpInputStream s)
        {
            int colNameCount = s.ReadListHead();
            string[] columnNames = new string[colNameCount];
            for (int i = 0; i < colNameCount; i++)
            {
                columnNames[i] = s.ReadBinaryAsString(); 
            }

            if (colNameCount > 0)
            {
                s.ReadNil();
            }

            int colTypeCount = s.ReadListHead();
            ColumnType[] columnTypes = new ColumnType[colTypeCount];
            for (int i = 0; i < colTypeCount; i++)
            {
                string a = s.ReadAtom();
                columnTypes[i] = (ColumnType)Enum.Parse(typeof(ColumnType), a, true);
            }

            if (colTypeCount > 0)
            {
                s.ReadNil();
            }

            return columnNames.Zip(columnTypes, (cname, ctype) => new Column(cname, ctype)).ToArray();
        }