No, you have to do that in your application.

In pseudo code your create function could do this:

    open the database file
    begin an exclusive transaction (since you may need to write to
initialize the tables)
    read the user_version
    if the user version is not zero
       create the tables (read SQL script into a string and pass the
string to sqlite3_exec)
       set the user version to a non zero value
    endif
    commit the transaction

Only one process will succeed in getting the write lock while opening
the transaction. That process will create the tables and set the
user_version so no other process will try to reinitialize the tables latter.

That solves the problem of two processes bootstrapping the database,
but is it possible for the second process to open the database while
the first is in the process of creating it (creating the header pages,
the system tables, etc) and view the database as corrupt since it
isn't fully created yet? I imagine there is at least a small window
between when the file is first created and when the file lock is
acquired on it, but I'm wondering how big that window is (or does it
not exist?).

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to