是否可以比较两个游标? [英] Is it possible to compare two cursors?

查看:37
本文介绍了是否可以比较两个游标?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要检查两个游标是否指向具有相同值的相同行.可能吗?

I need to check if two cursors pointing at the same rows with the same values. Is it possible?

更多详情:

  1. 我正在从我自己的 ContentProvider
  2. 加载数据
  3. 我正在向服务器发送请求,然后使用新值更新 ContentProvider 中的数据.
  4. 如果值发生更改 - 我需要通知用户他可以更新数据.

推荐答案

在 SQLite 中,行没有与其列值分开的标识(但 ROWID 是这些值之一).

In SQLite, rows do not have an identity separate from their column values (but the ROWID is one of these values).

您想要的要求您的数据有一些唯一的列作为游标的一部分,要么是 ROWID,要么是其他一些保证没有重复的键值.

What you want requires that your data has some unique column(s) as part of the cursor, either the ROWID, or some other key value that is guaranteed to have no duplicates.

否则,您永远无法知道您看到的是否只是恰好在这些列中具有相同值的两条记录.

Otherwise, you can never know if what you see is just two records that happen to have the same values in those columns.

这篇关于是否可以比较两个游标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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