On Sun, Sep 20, 2015 at 5:47 PM, Simon Slavin <slavins at bigfraud.org> wrote:
> > On 21 Sep 2015, at 12:32am, Scott Robison <scott at casaderobison.com> wrote: > > > 4. Step through the prepared statement from #1 again after doing any > > necessary reset. No finalize / re-prepare step. > > I believe that if you have done the first _step() then the SELECT will not > notice any schema change until you have received SQLITE_DONE or done > _reset() or _finalize(). In other words, you don't have to worry about the > issue. It might be interesting to check this with and without WAL > journalling. > > I agree that if you do a _reset() then you might have to worry about > columns being changed. I believe that _reset() releases locks, just like > the other two things I mentioned above. > Right, and that seems to be the crux of the OP question. Can he tell when a statement has been recompiled due to a schema change, because it might invalidate information he has cached locally in process. This may be a case of premature optimization, worrying about how much time a language boundary transition might take. Or perhaps the OP has found a use case where regular but not frequent schema changes might be called for. -- Scott Robison