use of com.aerospike.client.query.Statement in project aerospike-client-java by aerospike.
the class TestQueryPredExp method queryPredicate5.
@Test
public void queryPredicate5() {
int begin = 1;
int end = 10;
Statement stmt = new Statement();
stmt.setNamespace(args.namespace);
stmt.setSetName(setName);
stmt.setFilter(Filter.range(binName, begin, end));
stmt.setPredExp(PredExp.integerVar("x"), PredExp.integerValue(5), PredExp.integerUnequal(), PredExp.listBin("listbin"), PredExp.listIterateAnd("x"));
/*
stmt.setPredicate(
Predicate.listExclude("listbin", "x", Predicate.var("x").equal(5))
);
*/
RecordSet rs = client.query(null, stmt);
try {
int count = 0;
while (rs.next()) {
//System.out.println(rs.getRecord().toString());
count++;
}
assertEquals(8, count);
} finally {
rs.close();
}
}
use of com.aerospike.client.query.Statement in project aerospike-client-java by aerospike.
the class TestQueryString method queryString.
@Test
public void queryString() {
String filter = valuePrefix + 3;
Statement stmt = new Statement();
stmt.setNamespace(args.namespace);
stmt.setSetName(args.set);
stmt.setBinNames(binName);
stmt.setFilter(Filter.equal(binName, filter));
RecordSet rs = client.query(null, stmt);
try {
int count = 0;
while (rs.next()) {
Record record = rs.getRecord();
String result = record.getString(binName);
assertEquals(filter, result);
count++;
}
assertNotEquals(0, count);
} finally {
rs.close();
}
}
Aggregations