Skip to content
feiben edited this page Nov 22, 2015 · 7 revisions

We query any property with any value, if exists. Never need to specify which one is the key when inserting a record. Simple and Happy programming.

select records where age=25, LunarBase returns:

docID = 99, Value = {name=michale, age=25, payment=800, date=20150728};  
docID = 105, Value = {name=frank, age=25, payment=1200, date=20150729};  
......

Millions of records matching the query in DB.

The query language is quite simple.

/*  
 * construct an QuerySimple with a pair of property-value.  
 * LunarBase engine execute it, and returns the result.  
 * By default result handler, just print out.   
 *   
 * Here print out the latest 200 results that match.   
 * if the input count is less than 0, engine prints all the  
 * records that matches.  
 */  
 QuerySimple sq = new QuerySimple("age", "25", 200);  
 tc.dispatch(sq);  

Under the package of LCG.Examples, you will find a bunch of implementation of how to query. In practice, you need to implement your handler(this what we used special term for internal Event-Driven framework) to deal with query results like above. you may order them by the date, payment, or age. Check out how to do it under the package EventHandlerPackage

Clone this wiki locally