小编Rol*_*low的帖子

使用greenDao动态查询

我需要验证一些条件来创建一个完整的查询:

QueryBuilder qb = getMyObjDao().queryBuilder();

if(someCondition)

 qb.where(MyObjDao.Properties.Prop1.eq(someValue)); 
Run Code Online (Sandbox Code Playgroud)

else
qb.whereOr(MyObjDao.Properties.Prop2.eq(someValue),MyObjDao.Properties.Prop2.eq(someValue));

if(someOtherCondition)

 qb.where(MyObjDao.Properties.Prop3.eq(someValue)); 
Run Code Online (Sandbox Code Playgroud)

其他

 qb.whereOr(MyObjDao.Properties.Prop4.eq(someValue));
Run Code Online (Sandbox Code Playgroud)

那么是否可以连接查询构建器条件并动态创建查询构建器?或其他任何事情:

(a ='%'+ condition1或a ='%'+ condition1 +'%'或a = condition1 +'%')和
|(b ='%'+ condition2或b ='%'+ condition2 +'%'或b = condition2 +'%')和....

如何在绿道?

sqlite android greendao

4
推荐指数
1
解决办法
6038
查看次数

标签 统计

android ×1

greendao ×1

sqlite ×1