"James Butts" <[EMAIL PROTECTED]> wrote:
> 
> In the main thread, I open a connection to database and create a timer 
> function and start a worker thread.  The worker thread establishes its own 
> separate connection to database.  The worker thread creates a table and then 
> signals the main thread.  The timer function in the main thread drops the 
> table and signals back to the worker thread.  The worker thread creates the 
> table again and receives no error.  However, if the worker thread tries to 
> insert a record into that table, I get back a SQLITE_ERROR error.
> 

My guess is that the IF NOT EXISTS clause on the CREATE TABLE
is messing you up.  At the time sqlite3_prepare() runs, the
worker thread does not know that the main thread has deleted
the table, so the CREATE TABLE IF NOT EXISTS is compiled as
a no-op.  Only later when you try to actually use the table
does the work thread figure out that the table has been deleted.

Workaround:  Run the following statement prior to the CREATE TABLE:

   SELECT rowid FROM sqlite_master LIMIT 1;

--
D. Richard Hipp   <[EMAIL PROTECTED]>

Reply via email to