Exemplo n.º 1
0
        /// <summary>
        /// Creates a RowSet with few rows with int, text columns (null values in the last row)
        /// </summary>
        private static RowSet CreateSampleRowSet()
        {
            var columns = new List <CqlColumn>
            {
                new CqlColumn()
                {
                    Index    = 0,
                    Name     = "text_sample",
                    TypeCode = ColumnTypeCode.Text,
                    Type     = typeof(string)
                },
                new CqlColumn()
                {
                    Index    = 1,
                    Name     = "int_sample",
                    TypeCode = ColumnTypeCode.Int,
                    Type     = typeof(int)
                }
            };
            var columnIndexes = columns.ToDictionary(c => c.Name, c => c.Index);
            var rs            = new RowSet();
            var rowValues     = new[]
            {
                Encoding.UTF8.GetBytes("text value"),
                TypeCodec.EncodeInt(2, null, 100)
            };

            rs.AddRow(new Row(2, rowValues, columns.ToArray(), columnIndexes));
            rowValues = new byte[][]
            {
                null,
                null
            };
            rs.AddRow(new Row(2, rowValues, columns.ToArray(), columnIndexes));
            return(rs);
        }