如何将 ContentResolver 游标与数据库游标连接起来?
我通过查询 ContentResolver 从系统获取记录。我维护数据库中项目的顺序。所以我想按照从数据库中获取的顺序显示项目。
我如何合并这两个信息?
编辑1
我现在正在寻找替代方法。我理想中想要的是:
- 通过数据库中保存的自定义订单获取联系人顺序(这涉及将 CR 与我的数据库游标连接起来,并按以下顺序进行排序,稍后接缝使用 CursorJoiner 是不可能的),
- 但是还有更多,如果join 不是唯一的我想按联系人的姓名作为最后一个度量进行排序
的,因为缺少 order by 的功能,我还需要返回一个 Cursor,因为我将在 ExpandableList 中使用
,这是不可能使用 Cursor 和Joiners 翻译成 TSQL 它看起来像
select * from contactsdata
left join category on contactsdata.catid=category.id
order by category.pos asc, contact.display_name asc
所以我现在正在寻找替代方案。
我想要将 CR 中的所有数据加载到临时数据库表中,然后在临时表上进行查询,在其中我可以连接表并进行排序?您觉得这怎么样?
I get records from the system by quering a ContentResolver. I maintain the order of the items in the database. So I want to display the items in the order taken from my database.
How do I merge these two informations?
EDIT 1
I am looking after an alternative way now. As what I ideally want is:
- get order of contacts by a custom order held in my database (this involves joining CR with my DB cursor, and doing an order by, later seams it's not possible with CursorJoiner)
- but there is more, if the join is not unique I want to sort by contact's name as last measure
which is impossible using Cursor and Joiners, because of the missing feature of order bys, also I need to return a Cursor, as I will be using the in an ExpandableList
Also this translated to TSQL it would look like
select * from contactsdata
left join category on contactsdata.catid=category.id
order by category.pos asc, contact.display_name asc
So I am looking now after an alternative.
I have in mind to load in a temporary DB table all data from CR, then do the query on the temporary table where I can join tables and do order bys? How does this sound to you?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看一下
CursorJoiner
。如果这不起作用,你可以用相当多的痛苦、威士忌或两者都来滚动你自己的等价物。
Take a look at
CursorJoiner
.If that doesn't work, you can roll your own equivalent with a fair amount of pain, whiskey, or both.