当sqlite'文件超过最大大小时,它会改变计数器溢出吗?

时间:2015-09-01 23:39:18

标签: sqlite

根据http://www.sqlite.org/fileformat.html,SQLite3在数据库文件的字节file change counter中维护一个4字节的大端整数24..27

file change counter超过最大尺寸时会溢出吗?

(我觉得答案是:是的,它确实溢出

我问,因为我想要一些类似于sqlite文件的校验和,并通过另一个StackOverflow问题找到file change counterChecksum for a SQLite database?

1 个答案:

答案 0 :(得分:1)

文件更改计数器的实际值没有任何意义(不是版本号);唯一重要的是它与所有其他最近的价值观不同。

快速测试显示值包围:

$ sqlite3 test.db 'create table t(x);'
$ od --skip-bytes 24 --read-bytes 4 -tx1 test.db | cut -c9-
00 00 00 01
(lots of changes ...)
$ od --skip-bytes 24 --read-bytes 4 -tx1 test.db | cut -c9-
ff ff ff ff
$ sqlite3 test.db 'drop table t;'
$ od --skip-bytes 24 --read-bytes 4 -tx1 test.db | cut -c9-
00 00 00 00