Ron Stevens wrote:
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
is
Why not create it under a random name, and then rename after creation?
Noah Hart
-Original Message-
From: Ron Stevens [mailto:[EMAIL PROTECTED]
Sent: Tuesday, February 13, 2007 10:59 AM
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] Atomically creating a database and bootstrapping
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 tab
Ron Stevens wrote:
In general, does SQLite protect against the database being opened
while it's being created so other processes don't open it assuming
everything is in a good state?
Ron,
No, you have to do that in your application.
In pseudo code your create function could do this:
open
To bootstrap my db's I create a database template. Then make a physical copy of
that. Locking and access is done via flock. So the first process to gain the
lock wins and is respoonsible for making the copy, the other just waits until
the lock is released and then connects.
I make lots of da
I have two processes trying to access a database for the first time at
roughly the same time. I'm wondering if it's possible to atomically
create a database and bootstrap it with some tables from one process
so that the other process doesn't open the database either before
SQLite has finished writ
6 matches
Mail list logo