有效的方式来获得的Android / SQLite的未使用的ROWID? [英] Effective way to get unused rowid in Android/SQLite?
问题描述
假设你不希望回收的rowid为如下表mytable。
Suppose you do not want to recycle rowids for for table myTable below.
对于定义的:
CREATE TABLE myTable
(
id INTEGER PRIMARY KEY AUTOINCREMENT ,
<Other columns>
)
然后,你想在安卓/ SQLite的环境中一个未使用的ROWID。
Then you want to get next unused rowid in android/SQLite environment.
你将如何做有效的?
也许我们需要的对象
android.database.sqlite.SQLiteDatabase
也许(?)对象
android.database.sqlite.SQLiteStatement
Perhaps we need object android.database.sqlite.SQLiteDatabase and perhaps(?) object android.database.sqlite.SQLiteStatement
但什么是做这个任务最有效的方式?
but what is most efficient way to do this task?
请注意:
我不希望创建行插入myTable的。
当然,你可以创建行并删除它
如果是做这项工作的最佳方式。
Note: I do not want to create row into myTable. But of course you can create row and delete it if that is the best way to do the job.
推荐答案
您可以阅读序列从的 sqlite_sequence表。
这篇关于有效的方式来获得的Android / SQLite的未使用的ROWID?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!