Ticket Hash: | 0b91277bb4e13c7c68bdbbb76558871ed5dd5c35 | |||
Title: | Add option for a process exclusive mode to open files on Windows | |||
Status: | Closed | Type: | Feature_Request | |
Severity: | Important | Priority: | Medium | |
Subsystem: | Native_Assembly | Resolution: | Mailing_List | |
Last Modified: | 2020-03-05 01:03:14 | |||
Version Found In: | All to date | |||
User Comments: | ||||
anonymous added on 2020-01-24 02:27:10:
When making calls to the Win32 CreateFile() function, SQLite appears to always set the file sharing parameter dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE which allows the file to be opened for shared access across processes. CreateFile() must be called with a dwShareMode = 0 in order to open the file in a true process exclusive access mode. See https://docs.microsoft.com/en-us/windows/win32/fileio/creating-and-opening-files for full details. A side effect of this behavior is even when SQLite is configured for EXCLUSIVE WAL mode, users are still able to copy open SQLite database files on Windows using Explorer or other means which can result in corrupt copies that befuddle end users. To avoid this for our use cases, we're currently having to rebuild our own custom version of SQLite which allows us to force dwShareMode = 0. We're reaching out and see if there would be any appetite to add an option to allow for a process exclusive file access mode in the upstream SQLite? mistachkin added on 2020-01-26 21:06:55: Since this is a change to the core library, could you please bring this up on the public mailing list? [https://www.sqlite.org/support.html] |