Android 代理光标
我有一个数据库,我希望通过 ContentProvider 公开数据。然而,重要的是所有列都不要暴露,并且它们应该被重命名。有什么好的方法可以做到这一点吗?我在想也许某种代理光标可以接受光标并将其列转换为所需的列,并且对 close 等的调用只会重播到原始光标。这样的东西是否存在,或者很难制作?
I have a database with which I wish to expose data with a ContentProvider. However, it is important that all the colums are not exposed, and also they should be renamed. Is there any good way of doing this? I was thinking maybe some kind of proxy-cursor which takes a cursor and translates its columns to the desired ones, and calls to close and the like would just be replayed to the original cursor. Does something like this exist, or would it be hard to make?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以实现
CursorWrapper
过滤掉内容,或将数据复制到MatrixCursor
。You could either implement a
CursorWrapper
that filters stuff out, or copy the data into aMatrixCursor
.