Skip to content
feiben edited this page Jul 24, 2016 · 7 revisions

We query on any column with any value, if exists. Here we begin with an example:

Select records where age=25, LunarBase returns:

recID = 99, Value = {name=michale, age=25, payment=800, date=20150728};  
recID = 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.  
 */ 
 String table = "order"; 
 QuerySimple sq = new QuerySimple(table, "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 LHandler(this special term is what we used 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 this under the package [EventHandlerPackage] (https://github.com/LunarBaseEngin/Application/tree/master/src/LCG/DB/EventHandler/Customized) or this CustomizedHandler Chapter

Clone this wiki locally