Android的我可以使用JOIN在mediastore查询 [英] Android Can I use JOIN at mediastore query

查看:145
本文介绍了Android的我可以使用JOIN在mediastore查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有使用在一次查询时mediastore数据的方法?

is there any method to use join in a query at mediastore data?

或者也有没有通过数据库和不访问mediastore数据与内容提供商的方法?

Or also is there any method to access the mediastore data through a database and not with the content provider?

感谢你。

推荐答案

不过,我认为,你可以使用连接与内容提供商。如果你把两个查询,您可以通过使用CursorJoiner加入他们的行列。我用它和它的作品很好。

But I think that you can use joins with content providers. If you make two queries, you can join them by using CursorJoiner. I am using it and it works good.

片段从Android的文档:

Snippet from Android docs:

CursorJoiner joiner = new CursorJoiner(cursorA, keyColumnsofA, cursorB, keyColumnsofB);
 for (CursorJointer.Result joinerResult : joiner) {
     switch (joinerResult) {
         case LEFT:
             // handle case where a row in cursorA is unique
             break;
         case RIGHT:
             // handle case where a row in cursorB is unique
             break;
         case BOTH:
             // handle case where a row with the same key is in both cursors
             break;
     }
 }

这是不完全的SQL连接相同,但它是有用的。在每一个案例,你可以用两个光标这是指向处理过的行处理。

it is not exactly the same as SQL join but its useful. In each "case" you can manipulate with both cursors which are pointing to processed row.

这篇关于Android的我可以使用JOIN在mediastore查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆