"Andrew Shakinovsky" <[EMAIL PROTECTED]> wrote:
> According to the docs, I am asked to finalize the
> statement [after SQLITE_SCHEMA], and re-prepare it. Unfortunately
> this doesn't fit nicely into my architecture. 

It is easy to put wrappers around sqlite3_prepare(),
sqlite3_step(), and sqlite3_finalize() to fix this.  

Have your sqlite3_prepare() wrapper return an object
that holds both the sqlite3_stmt* and a copy of the
original SQL text.  The sqlite3_step() wrapper (which
can be a method on the previous object) should call
sqlite3_reset() if it finds an error, and if the error
is SQLITE_SCHEMA, it can prepare a new sqlite3_stmt,
transfer bindings from the old to the new, finalize
the old, and retry the sqlite3_step().  The sqlite3_finalize()
wrapper is just the destructor on the object that
your sqlite3_prepare() wrapper returned.

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

Reply via email to