Dixon Hutchinson wrote:
I think this is a different question, unrelated to the previous
sqlite_open thread.
I'm in a WIN32 environment. I'm using:
h = CreateFile(path, GENERIC_READ, FILE_SHARE_READ ||
FILE_SHARED_WRITE,
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
to establish if my DB exists before I open it. If it does exist, I
close the handle "h" immediately. I then call sqlite3_open. If the
file did not previously exists, I then create my tables.
Dioxn,
Shouldn't that be:
h = CreateFile(...., FILE_SHARE_READ | FILE_SHARE_WRITE, ...)
With a bitwise OR operator and FILE_SHARE_WRITE not FILE_SHARED_WRITE.
You also have a race condition. If another process deletes the file
after you close the handle but before sqlite opens it you will end up
using an uninitialized database. You should look at using the pragma
user_version command to detect if your database has been initialized
(search for previous posts).
HTH
Dennis Cote
-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------