问题描述
我看到一些奇怪的行为与我的应用程序和数据库文件运行一些测试,关闭数据库,将其删除,并用测试夹具更换后的状态。当我审视我的调试PC上的工具,数据库文件,它不匹配的应用程序本身似乎汇报。这可能是因为这种奇怪的行为是有关这个bug 。
I am seeing some strange behavior with my application and the state of its database file after running some tests that close the database, delete it, and replace it with a test fixture. When I examine the database file with a tool on my debugging PC, it doesn't match what the application itself seems to be reporting. It's possible that this strange behavior is related to this bug.
我注意到,有两个文件具有相同的基本名称的数据库(与正常 .db的
扩展名)的文件扩展名是 .db的-SHM
和 .db的-沃尔玛
,且各自为较新的 .db的
文件的时间戳。
I noticed that there are two files with the same base name as the database (with the normal .db
extension.) The file extensions are .db-shm
and .db-wal
, and each is newer than the .db
file's timestamp.
我认为这是某种类型的临时文件。不过,我想知道,如果应用程序被终止,要他们不被删除?更重要的是,我认为无论数据存储在其中的 .db的
文件中被更新的应用程序是由操作系统终止之前。这是正确的?
I assume that these are some type of temporary files. However, I am wondering if the application is terminated, shouldn't they be deleted? More importantly, I assume whatever data is stored in them is updated inside the .db
file before the application is terminated by the operating system. Is this correct?
推荐答案
您是正确的,这些都是SQLite创建的临时文件。如果手动删除主DB你或许应该删除这些了。从我可以收集WAL是替代回滚日志,使SQLite的,当一个事务失败回滚的变化。如何SQLite的使用他们,为什么他们不停地围绕了这么久达的SQLite的作者,但一般的SQLite似乎pretty的坚如磐石所以我不会太担心他们。欲了解更多信息看看这里:
You are correct, these are temporary files created by SQLite. If you are manually deleting the main db you should probably delete these too. From what I can gather the WAL is a replacement for the rollback journal that enables SQLite to rollback changes when a transaction fails. How SQLite uses them and why they are kept around for so long is up to the authors of SQLite but in general SQLite seems pretty rock solid so I wouldn't worry too much about them. For more info take a look here:
http://www.sqlite.org/fileformat2.html#walindexformat
这些文件是的SQLite 3.7的新功能。我不知道他们的存在关系到你指出了错误,但错误报告提出了一个解决方法呢。
These files are a new feature of SQLite 3.7. I'm not sure if their existence relates to the bug you point out but the bug report suggests a work-around anyway.
这篇关于什么是SQLite数据库带.db,SHM和.db的,沃尔玛的扩展?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!