android.database.sqlite.SQLiteDatabase.insert(...) 返回的 long 是否有目的?
我正在使用 SQLiteDatabase 类,但不明白为什么插入方法返回很长,因为您不能在任何其他方法(删除、查询、更新)中使用它,还是我错过了一些东西?这个id长的目的是什么?
I'm playing around with the SQLiteDatabase class and did't understand why the insert method returns a long since you cannot use it in any other method (delete, query, update) or am I missing something? What's is the purpose of this id long?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
那个 long 就是新插入行的行 ID。是的,您可以在
delete
、query
和update
方法中使用它。例如:That long is the row ID of the newly inserted row. And yes, you can use it in
delete
,query
andupdate
methods. For instance:我从 SQLite 文档 http://www.sqlite.org/lang_createtable 中找到了本节的完整答案.html#rowid
I found out the complete answer in this section from SQLite documentation http://www.sqlite.org/lang_createtable.html#rowid
SQLite 将 INTEGER 存储为 64 位,这相当于同样为 64 位的 Java long 基本类型。
SQLite stores INTEGER as 64-bit which is equivalent to Java long primitive type at also 64-bits.