当用户隐藏所有列名时,如何使用 C API 可靠地获取/利用 SQLite 行 ID?
根据SQLite文档,所有表默认都有rowid,并且不能删除。这个 rowid 可以通过 rowid
、oid
或 _rowid_
来访问。
不管怎样,数据库用户可以自由添加带有名称的新列,并且这些列将被隐藏。访问 rowid 的唯一方法是使用INTEGER PRIMARY KEY
创建一个新列。
这是我目前的理解。有了这个,如果用户隐藏所有列并且用户没有创建任何 PK 列,我就没有可靠的方法来获取 rowid 。我也想过加个临时PK栏,但这也不太靠谱。如果这是真的,那就没有意义了。因为数据始终可用,但我只是无法访问,因为没有合适的接口。
所以我认为应该有一种方法来可靠地访问这些数据。但我找不到任何关于 C API 的东西。我可以为此提供一些指导吗?
According to SQLite documentation, All tables have rowid by default, and it cannot be removed. And this rowid can be accessed with rowid
, oid
or _rowid_
.
Anyway database users can add the new column with the names freely, and the columns will be hidden. The only way to access rowid is making a new column with INTEGER PRIMARY KEY
.
This is my current understanding. And with this, I have no reliable way to get the rowid if user hide all the columns and user didn't make any PK column. I have thought about adding temporary PK column, but this is unreliable too. If this is true, this doesn't make sense. Because the data is always available, and I just cannot access because there's no appropriate interface.
So I think there should be a way to access this data reliably. But I couldn't find anything with C API. Can I have some guidance for this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论