The person who pays attention will find that in the process of generating the SQLite database file on the SD card in Android, the next side of the generated. db file is found.
A. db-journal file with the same name as the database file was generated with a size of 0 and did not understand the purpose of the file, so
Google has the official SQLite document, found that the purpose of the file is as follows:
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 a program crashes or the system loses power, the file remains on disk for the next program to run
When a transaction is rolled back.
But when I created the database, I ended the transaction, and the program didn't crash, and why would I still have it on disk?
Where is the. db-journal file?
In-depth study, found that this is the SQLite generated log files caused by different modes, in the Android adoption of this mode,
. db-journal file is permanently left on the disk and will not be automatically purged if a transaction rollback does not occur. Db-journal
the size of the file is 0, which avoids the cost of generating and deleting. db-journal files each time.
To this, all the doubts were untied.
The generation and causes of Android SQLite db-journal files