On Wed, Jan 25, 2012 at 9:50 AM, Richard Hipp <d...@sqlite.org> wrote:

> On Wed, Jan 25, 2012 at 9:02 AM, John Elrick <john.elr...@fenestra.com
> >wrote:
>
> >
> > current state = 'db=03FB1188, db->aDb[pOp->p1].pSchema=02110AB0,
> > db->aDb[pOp->p1].pSchema->schema_cookie=27,
> > db->aDb[pOp->p1].pSchema->iGeneration=63, u.av.iMeta=27, u.av.iGen=63,
> > pOp->p1=1, pOp->p2=27, pOp->p3=0'
> >
> > sql = 'update alerter_links    set is_dirty = null '
> >
> > Obviously, iGeneration and p3 are out of sync.  So, what exactly is
> pOp->p3
> > ?
> >
>
> pOp->p3 is suppose to be the value of iGeneration when the statement was
> first prepared.  It is set here:
> http://www.sqlite.org/src/artifact/8e2a4dedad?ln=160-162
>
> I'm a little concerned that pOp->p3 is zero when iGeneration is 63.  That's
> a lot of changes.  When was the statement first prepared?  When the program
> first starts up?  Or is pOp->p3 getting zeroed somehow?


As much as possible, we are using lazy initialization.  A query is prepared
the first time it is used, but the prepared query should be retained until
shutdown.


I do have some more information for you.  I tracking everything which could
call reset and discovered that all of these are stemming from

SQLITE_PRIVATE int sqlite3VdbeHalt(Vdbe *p){
....
    /* Rollback or commit any schema changes that occurred. */
    if( p->rc!=SQLITE_OK && db->flags&SQLITE_InternChanges ){
fenestra_sqlite3_dump_stack_trace("rollback in vdbeHalt");
  sqlite3ResetInternalSchema(db, -1);
      db->flags = (db->flags | SQLITE_InternChanges);
    }

I added a logging item and retrieved the following data:

status = 'p->rc=17, db->flags=48100a00, SQLITE_InternChanges=200'

So, it appears that something is making SQLite think the schema has changed.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to