That's basically the way I do it. I have a factory method for all prepared statements, where I wrap the (optional) recompilation in and aquire a named mutex for every method invocation in the class.
I think this should be a safe approach to prevent SQLITE_SCHEMA errors if the only schema changes occur on the same sqlite3 connection. (E.g. no other process, thread or connection changes the schema.) Mike >> Looking at the implementation of sqlite3_expired, its just a >> comparison of the expired flag in the statement or if the >> passed statement is NULL. The cost is an additional if >> statement before execution, however this does not save you >> from SQLITE_SCHEMA errors. In theory someone could modify the >> schema just after you called sqlite3_expired, but before you >> step the statement. > >I've acquired a mutex lock at this point so no danger of another thread >clobbering the schema before the step. > >I'm also testing for NULL statements anyway (first pass). I figured >an ease way to avoid schema errors would be to change: > >if (db._insertStatement == NULL) >{ > // preparation > >to: > >if (sqlite3_expired(db._insertStatement)) >{ > // preparation > >> >> The question should more likely be: When is the expired flag set? >> > >I agree. > >Daniel. > >============================================================================== > >Please access the attached hyperlink for an important electronic >communications disclaimer: > >http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html >============================================================================== > > > >----------------------------------------------------------------------------- >To unsubscribe, send email to [EMAIL PROTECTED] >----------------------------------------------------------------------------- > ----------------------------------------------------------------------------- To unsubscribe, send email to [EMAIL PROTECTED] -----------------------------------------------------------------------------