使用合并光标

发布于 2024-11-28 03:09:53 字数 1152 浏览 3 评论 0原文

我有 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文