Android 短信数据库与联系人数据下的.db-wal文件

Android 2.3开始采用Sqlite 3.7,而SQLite 3.7开始引入WAL Mode(Write Ahead Log),一种新的事务控制机制,

所以我们会在系统的短信与联系人的数据库下看到.db-wal的文件格式,如图所示。

引入的目的是为了保证数据库中的一致性,避免程序发生崩溃的时候也能保证数据库的一致性。所以,这就是为什么

第3方的程序有时能够正常读到联系人的数据,有时却读不到的原因,用户遇到这种情况,最好重启下机器。

WAL文件格式的详细说明见: http://www.sqlite.org/fileformat2.html

其中提到:

A WAL file consists of a header followed by zero or more "frames". Each frame records the revised content of a single page from the database file. All changes to the database are recorded by writing frames into the WAL. Transactions commit when a frame is written that contains a commit marker. A single WAL can and usually does record multiple transactions. Periodically, the content of the WAL is transferred back into the database file in an operation called a "checkpoint".

A single WAL file can be reused multiple times. In other words, the WAL can fill up with frames and then be checkpointed and then new frames can overwrite the old ones. A WAL always grows from beginning toward the end. Checksums and counters attached to each frame are used to determine which frames within the WAL are valid and which are leftovers from prior checkpoints.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值