[Turn]android sqlite db-journal file Cause and description

Source: Internet
Author: User
Tags sqlite db

In the process of generating SQLite database files on an SD card in Android today, A. db-journal file with the same name as the database file is generated next to the generated. db file, and Google has an official document for SQLite because it does not understand the purpose of the file.

Find the file for the following purposes:

This file is a temporary log file of SQLite, mainly used for sqlite transaction rollback mechanism, generated at the beginning of the transaction, deleted at the end of the transaction, when the program crashes or the system loses power, the file remains on disk so that the next time the program runs, the transaction is rolled back.

But when I created the database and ended the transaction, and the program didn't crash, why would I still have a. db-journal file on disk?

In-depth research, found that this is a different mode of SQLite generated log files caused by the android in this mode, the. db-journal file is permanently left on the disk will not be automatically erased, If a transaction rollback does not occur then the size of the. db-journal file is 0, which avoids the overhead of generating and deleting. db-journal files each time.

To this, all the doubts were untied.

Original link: http://blog.csdn.net/kaiwii/article/details/8609093

[Turn]android sqlite db-journal file Cause and description

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.