On Jan 11, 2016, at 11:25 AM, Felipe Gasper <felipe at felipegasper.com> wrote: > > To prevent race conditions where a 2nd process accesses a newly-created > SQLite file before the creator process can set up the schema
On POSIX systems, you can securely create a temp file that only your user can see via the mkstemp(3) C library call. SQLite will happily open the resulting 0-byte file, allowing you to create your schema inside it. Then when the file is set up, you can move it into the desired location and change its file modes so that the other processes can open it. There must be an equivalent of mkstemp() on Windows, doubtless taking 3 times as many parameters and with a function name 4 times as long. :)