sqlite中的journal
journal 主要用途是,当事务要修改page时,先把未修改的page存入journal中,如果事务rollback时,就从journal中得到修改前的数据,覆盖已改的,达到事务的一致性。 journal是一个不同于数据库文件的另一个文件,它在事务开始时创建,当事务结束时就删除了 The format for the journal header is as follows: ** The journal file format is as follows: **** (1) 8 byte prefix. A copy of aJournalMagic[].** (2) 4 byte big-endian integer which is the number of valid page records** in the journal. If this value is 0xffffffff,then compute the** number of page records from the journal size.** (3) 4 byte big-endian integer which is the initial value for the ** sanity checksum.** (4) 4 byte integer which is the number of pages to truncate the** database to during a rollback.** (5) 4 byte big-endian integer which is the sector size. The header** is this many bytes in size.** (6) 4 byte big-endian integer which is the page size.** (7) zero padding out to the next sector size.** (8) Zero or more pages instances,each as follows:** + 4 byte page number.** + pPager->pageSize bytes of data.** + 4 byte checksum**** When we speak of the journal header,we mean the first 7 items above.** Each entry in the journal is an instance of the 8th item. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |