我想使用 SQLite 及其自动增量列。但我想知道如果该值达到最大值(2,147,483,647 是“long”类型的最大值)会发生什么 有人知道吗?
最佳答案
这记录在 documentation 中.
没有自动增量:
If the largest ROWID is equal to the largest possible integer (9223372036854775807) then the database engine starts picking positive candidate ROWIDs at random until it finds one that is not previously used. If no unused ROWID can be found after a reasonable number of attempts, the insert operation fails with an SQLITE_FULL error.
使用自动增量:
If the table has previously held a row with the largest possible ROWID, then new INSERTs are not allowed and any attempt to insert a new row will fail with an SQLITE_FULL error.
关于android - 当自动增量列超过 SQLite 中的最大值时会发生什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35127862/