使用合并光标
我有 3 个对数据库的请求,它们返回 Cursor a、b、c。示例查询:
public Cursor SearchQueryMoscow (String query ){
Cursor m;
a = sqldb.query(true, DataBase.TABLE_NAME, new String[]{KEY_ROWID,ADRESS2,TIME2
,PRICE2,OBJECT2,OPICANIE2,FINDWC2,DISTANSHIONMETRO2,CITY2},CITY2 + " IN ('ROMA') and ("
+ " adress LIKE " + "'%" + query + "%'"
+ " OR gowc LIKE " + "'%" + query + "%'"
+ " OR timework LIKE " + "'%" + query + "%'"
+ " OR price LIKE " + "'%" + query + "%'"
+ " OR mesto LIKE " + "'%" + query + "%'"
+ " OR opicanie LIKE " + "'%" + query + "%'"
+ " OR distanshionmetro LIKE " + "'%" + query + "%')"
, null, null, null, null, null);
return a ;}
如何使用 MergeCursor 组合三个游标的结果? 我写道:
MergeCursor mergecursor = new MergeCursor(mCursors);
如何进一步合并三个游标的结果? 看到的示例
I have 3 requests to the database, which return Cursor a,b,c. Sample query:
public Cursor SearchQueryMoscow (String query ){
Cursor m;
a = sqldb.query(true, DataBase.TABLE_NAME, new String[]{KEY_ROWID,ADRESS2,TIME2
,PRICE2,OBJECT2,OPICANIE2,FINDWC2,DISTANSHIONMETRO2,CITY2},CITY2 + " IN ('ROMA') and ("
+ " adress LIKE " + "'%" + query + "%'"
+ " OR gowc LIKE " + "'%" + query + "%'"
+ " OR timework LIKE " + "'%" + query + "%'"
+ " OR price LIKE " + "'%" + query + "%'"
+ " OR mesto LIKE " + "'%" + query + "%'"
+ " OR opicanie LIKE " + "'%" + query + "%'"
+ " OR distanshionmetro LIKE " + "'%" + query + "%')"
, null, null, null, null, null);
return a ;}
Нow to combine the result of three cursors using MergeCursor?
I wrote:
MergeCursor mergecursor = new MergeCursor(mCursors);
how to further combine the results of three cursors?
example seen
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论