Inner join with Cursors resulting another Cursor o

2019-08-16 02:14发布

In fact I have 2 Cursors one is SQLite cursor, another one comes from ContentProvider - beneath it lies complicated SQLite query - but I don't have access to it.

Both cursors has the same unique _ID field. In a pure SQL it would be really easy to join them using those id field, but not in my case, since 2nd Cursor is not SQLite query.

I need to produce resulting joined Cursor. Neither CursorJoiner nor MergeCursor doesn't help me.

Any ideas, clues, hints?

1条回答
放荡不羁爱自由
2楼-- · 2019-08-16 02:56

Option #1: Write your own implementation of Cursor -- perhaps extending AbstractCursor -- that does the join. I have some ancient code in an obsolete version of a discontinued book that demonstrates this (see pages 186-190).

Option #2: Create a MatrixCursor that represents the join.

查看更多
登录 后发表回答