Wait - what if AUTOVACUUM is set on the database, and I'm the only one doing
inserts/deletes? Will I still need to sqlite3_prepare() my statements again
if auto-vacuum is on?

-Dave 

-----Original Message-----
From: D. Richard Hipp [mailto:[EMAIL PROTECTED] 
Sent: Sunday, July 10, 2005 4:12 AM
To: sqlite-users@sqlite.org
Subject: RE: [sqlite] Binding a column name?

On Sun, 2005-07-10 at 00:23 -0700, Brown, Dave wrote:
> That is what I do. But that also means I have to call sqlite_prepare() 
> each time, instead of just once. I was originally hoping I could 
> prepare() once and just bind.
> 

If another thread or process VACUUMs the database or creates a new table or
makes any other structure changes to the database file, all of your prepared
statements will be invalided and you will have to rerun sqlite3_prepare().
Since you generally have no control over when another process might VACUUM
the database, you should always be prepared to rerun sqlite3_prepare() if
necessary.  This is true even if you are only running your SQL statement
once and then finalizing it because another process might VACUUM and
invalidate your statement in the very brief window of time between your
calls to sqlite3_prepare() and sqlite3_step().

Your best bet it to use a wrapper class of some sort that automates the task
of rerunning sqlite3_prepare() when necessary.

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

Reply via email to