有什么方法可以在媒体存储数据的查询中使用联接?
或者还有什么方法可以通过数据库而不是内容提供者来访问媒体存储数据?
谢谢你。
但我认为你可以使用内容提供者的连接。如果您进行两个查询,您可以使用 CursorJoiner 将它们连接起来。我正在使用它并且效果很好。
来自 Android 文档的片段:
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 连接并不完全相同,但它很有用。在每种“情况”中,您都可以使用指向已处理行的两个游标进行操作。
有什么方法可以在媒体存储数据的查询中使用联接?
抱歉,内容提供者查询无法进行 JOIN。
或者还有什么方法可以通过数据库而不是内容提供者来访问媒体存储数据?
仅当您编写自己的固件时。