Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/71.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Cassandra Batch_mutate()_Cassandra - Fatal编程技术网

Cassandra Batch_mutate()

Cassandra Batch_mutate(),cassandra,Cassandra,请提供一个关于如何在C#net中使用batch#u mutate()的示例 提前感谢。字典=新字典(); Dictionary <string, Dictionary<string, List<Mutation>>> dictionary = new Dictionary<string, Dictionary<string, List<Mutation>>>(); List<Mutation> columnsT

请提供一个关于如何在C#net中使用batch#u mutate()的示例

提前感谢。

字典=新字典();
Dictionary <string, Dictionary<string, List<Mutation>>> dictionary = new Dictionary<string, Dictionary<string, List<Mutation>>>();

List<Mutation> columnsToadd = new List<Mutation>();
List<Column> customers = new List<Column>();

//List of SuperColumns

customers.Add(new Column() { Name = utf8Encoding.GetBytes("street"), Timestamp = timeStamp, Value = utf8Encoding.GetBytes("Test") });

customers.Add(new Column() { Name = utf8Encoding.GetBytes("Zip"), Timestamp = timeStamp, Value = utf8Encoding.GetBytes("Test") });

customers.Add(new Column() { Name = utf8Encoding.GetBytes("city"), Timestamp = timeStamp, Value = utf8Encoding.GetBytes("Test Hills") });

Dictionary<string, List<Mutation>> innerMap = new Dictionary<string, List<Mutation>>();
Mutation columns = new Mutation()
{
 Column_or_supercolumn = new ColumnOrSuperColumn() { Super_column = new SuperColumn() { Name = utf8Encoding.GetBytes("John1"), Columns = customers } }
};

columnsToadd.Add(columns);
ColumnPath nameColumnPath = new ColumnPath()
 {
       Column_family = "Super1",
       Super_column = utf8Encoding.GetBytes("John1"),
       Column = utf8Encoding.GetBytes("customers")
 };
 innerMap.Add("Super1", columnsToadd);
 dictionary.Add("Phatduckk", innerMap);
 client.batch_mutate("Keyspace1", dictionary, ConsistencyLevel.ONE);
List columnsToadd=新列表(); 列出客户=新列表(); //超级柱列表 Add(新列(){Name=utf8Encoding.GetBytes(“street”),Timestamp=Timestamp,Value=utf8Encoding.GetBytes(“Test”)}); Add(新列(){Name=utf8Encoding.GetBytes(“Zip”),Timestamp=Timestamp,Value=utf8Encoding.GetBytes(“Test”)}); Add(新列(){Name=utf8Encoding.GetBytes(“城市”),Timestamp=Timestamp,Value=utf8Encoding.GetBytes(“测试”)}); Dictionary innerMap=新字典(); 突变列=新突变() { Column_或_supercolumn=new Column或supercolumn(){Super_Column=new supercolumn(){Name=utf8Encoding.GetBytes(“John1”),Columns=customers} }; columnsToadd.Add(列); ColumnPath name ColumnPath=新ColumnPath() { Column_family=“Super1”, Super_column=utf8Encoding.GetBytes(“John1”), Column=utf8Encoding.GetBytes(“客户”) }; innerMap.Add(“Super1”,columnsToadd); 添加(“Phatduckk”,innerMap); client.batch_mutate(“Keyspace1”,dictionary,consistentylevel.ONE);
我使用的是datastax驱动器,我没有类“突变”、“列”、“列”或“超级列”、“超级列”、“列修补程序”等^。你在使用哪个客户端?