android - GreenDao select in range with BETWEEN operator -


i use greendao , have entity defined class:

dot {     string name;     float value; } 

and want extract database dots have value in between value - 1 , value + 1. sql query should lik this:

select * dot value between(value-1, value+1) 

can same in greendao, maybe:

querybuilder<dot> query = dotdao.querybuilder(); query.where(dotdao.properties.value.between(dotdao.properties.value-1, dotdao.properties.value+1)); list<range> rangelist = query.list(); 

is possible or have use raw queries?

you can use , operator.

for example:

querybuilder<dot> query = dotdao.querybuilder(); list<range> rangelist = query.where(dotdao.properties.value.ge(value - 1), dotdao.properties.value.le(value + 1)) .list(); 

details http://greendao-orm.com/documentation/queries/


Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -