Matthew Jones <[EMAIL PROTECTED]> wrote: > what should our program do prior to > preparing a statement to ensure that its view of the database schema is > correct? >
The only way for a database connection to know if the schema has changed is to open and read the database file. Sqlite_prepare() tries to avoid reading the database file in order to reduce contention, though, so it is unlikely to discover a database change. The change is only discovered when sqlite3_step() is run. Having sqlite3_prepare() avoid opening and reading the database file is a desirable optimization since it makes sqlite3_prepare() run faster in the common case where no schema change occurs. The only way I know of to force sqlite3_prepare() to check the database schema is to close and reopen the database connection. But doing so will dramatically increase the amount of time it takes to prepare each statement. Your best approach is to modify your code so that you are prepared to deal with SQLITE_SCHEMA errors returned by sqlite3_step. You'll need this anyway for the rare case when the schema changes in between sqlite3_prepare and sqlite3_step. -- D. Richard Hipp <[EMAIL PROTECTED]> ----------------------------------------------------------------------------- To unsubscribe, send email to [EMAIL PROTECTED] -----------------------------------------------------------------------------