public void QueryMap6() { int begin = 1; int end = 10; Statement stmt = new Statement(); stmt.SetNamespace(args.ns); stmt.SetSetName(setName); stmt.SetFilter(Filter.Range(binName, begin, end)); // Map bin contains keys "A" and "C". QueryPolicy policy = new QueryPolicy(); List <string> list = new List <string>(); list.Add("A"); list.Add("C"); policy.filterExp = Exp.Build( Exp.EQ( ListExp.Size( // return type VALUE returns a list MapExp.GetByKeyList(MapReturnType.VALUE, Exp.Val(list), Exp.MapBin("mapbin"))), Exp.Val(2))); RecordSet rs = client.Query(policy, stmt); try { int count = 0; while (rs.Next()) { //Console.WriteLine(rs.Record.ToString()); count++; } Assert.AreEqual(1, count); } finally { rs.Close(); } }
public void QueryMap4() { int begin = 1; int end = 10; Statement stmt = new Statement(); stmt.SetNamespace(args.ns); stmt.SetSetName(setName); stmt.SetFilter(Filter.Range(binName, begin, end)); // Map bin does not contains value "AAA" QueryPolicy policy = new QueryPolicy(); policy.filterExp = Exp.Build( Exp.EQ( MapExp.GetByValue(MapReturnType.COUNT, Exp.Val("AAA"), Exp.MapBin("mapbin")), Exp.Val(0))); RecordSet rs = client.Query(policy, stmt); try { int count = 0; while (rs.Next()) { //Console.WriteLine(rs.Record.ToString()); count++; } Assert.AreEqual(7, count); } finally { rs.Close(); } }