/ Check-in [59662cd2]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Create the sqlite3IsToplevel(Parse*) interface to check to see if a top-level VDBE is being coded (versus a trigger) and use that interface.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | vtab-onepass
Files: files | file ages | folders
SHA1:59662cd2b65255a30e1a420331c07c51b644621a
User & Date: drh 2015-09-29 13:25:15
Context
2015-09-29
15:50
Remove dead code, replacing with assert() statements that make sure the code really was dead. Closed-Leaf check-in: 0e317dda user: drh tags: vtab-onepass
13:25
Create the sqlite3IsToplevel(Parse*) interface to check to see if a top-level VDBE is being coded (versus a trigger) and use that interface. check-in: 59662cd2 user: drh tags: vtab-onepass
12:32
Fix compiler warnings. check-in: d1a07838 user: drh tags: vtab-onepass
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/delete.c.

   514    514       if( IsVirtual(pTab) ){
   515    515         const char *pVTab = (const char *)sqlite3GetVTable(db, pTab);
   516    516         sqlite3VtabMakeWritable(pParse, pTab);
   517    517         sqlite3VdbeAddOp4(v, OP_VUpdate, 0, 1, iKey, pVTab, P4_VTAB);
   518    518         sqlite3VdbeChangeP5(v, OE_Abort);
   519    519         assert( eOnePass==ONEPASS_OFF || eOnePass==ONEPASS_SINGLE );
   520    520         sqlite3MayAbort(pParse);
   521         -      if( eOnePass==ONEPASS_SINGLE && pParse==sqlite3ParseToplevel(pParse) ){
          521  +      if( eOnePass==ONEPASS_SINGLE && sqlite3IsToplevel(pParse) ){
   522    522           pParse->isMultiWrite = 0;
   523    523         }
   524    524       }else
   525    525   #endif
   526    526       {
   527    527         int count = (pParse->nested==0);    /* True to count changes */
   528    528         int iIdxNoSeek = -1;

Changes to src/insert.c.

   256    256     int memId;                 /* Register holding max rowid */
   257    257     int addr;                  /* A VDBE address */
   258    258     Vdbe *v = pParse->pVdbe;   /* VDBE under construction */
   259    259   
   260    260     /* This routine is never called during trigger-generation.  It is
   261    261     ** only called from the top-level */
   262    262     assert( pParse->pTriggerTab==0 );
   263         -  assert( pParse==sqlite3ParseToplevel(pParse) );
          263  +  assert( sqlite3IsToplevel(pParse) );
   264    264   
   265    265     assert( v );   /* We failed long ago if this is not so */
   266    266     for(p = pParse->pAinc; p; p = p->pNext){
   267    267       pDb = &db->aDb[p->iDb];
   268    268       memId = p->regCtr;
   269    269       assert( sqlite3SchemaMutexHeld(db, 0, pDb->pSchema) );
   270    270       sqlite3OpenTable(pParse, 0, p->iDb, pDb->pSchema->pSeqTab, OP_OpenRead);

Changes to src/sqliteInt.h.

  3500   3500                                           Select*,u8);
  3501   3501     TriggerStep *sqlite3TriggerUpdateStep(sqlite3*,Token*,ExprList*, Expr*, u8);
  3502   3502     TriggerStep *sqlite3TriggerDeleteStep(sqlite3*,Token*, Expr*);
  3503   3503     void sqlite3DeleteTrigger(sqlite3*, Trigger*);
  3504   3504     void sqlite3UnlinkAndDeleteTrigger(sqlite3*,int,const char*);
  3505   3505     u32 sqlite3TriggerColmask(Parse*,Trigger*,ExprList*,int,int,Table*,int);
  3506   3506   # define sqlite3ParseToplevel(p) ((p)->pToplevel ? (p)->pToplevel : (p))
         3507  +# define sqlite3IsToplevel(p) ((p)->pToplevel==0)
  3507   3508   #else
  3508   3509   # define sqlite3TriggersExist(B,C,D,E,F) 0
  3509   3510   # define sqlite3DeleteTrigger(A,B)
  3510   3511   # define sqlite3DropTriggerPtr(A,B)
  3511   3512   # define sqlite3UnlinkAndDeleteTrigger(A,B,C)
  3512   3513   # define sqlite3CodeRowTrigger(A,B,C,D,E,F,G,H,I)
  3513   3514   # define sqlite3CodeRowTriggerDirect(A,B,C,D,E,F)
  3514   3515   # define sqlite3TriggerList(X, Y) 0
  3515   3516   # define sqlite3ParseToplevel(p) p
         3517  +# define sqlite3IsToplevel(p) 1
  3516   3518   # define sqlite3TriggerColmask(A,B,C,D,E,F,G) 0
  3517   3519   #endif
  3518   3520   
  3519   3521   int sqlite3JoinType(Parse*, Token*, Token*, Token*);
  3520   3522   void sqlite3CreateForeignKey(Parse*, ExprList*, Token*, ExprList*, int);
  3521   3523   void sqlite3DeferForeignKey(Parse*, int);
  3522   3524   #ifndef SQLITE_OMIT_AUTHORIZATION

Changes to src/update.c.

   760    760     bOnePass = sqlite3WhereOkOnePass(pWInfo, aDummy);
   761    761   
   762    762     if( bOnePass ){
   763    763       /* If using the onepass strategy, no-op out the OP_OpenEphemeral coded
   764    764       ** above. Also, if this is a top-level parse (not a trigger), clear the
   765    765       ** multi-write flag so that the VM does not open a statement journal */
   766    766       sqlite3VdbeChangeToNoop(v, addr);
   767         -    if( sqlite3ParseToplevel(pParse)==pParse ){
          767  +    if( sqlite3IsToplevel(pParse) ){
   768    768         pParse->isMultiWrite = 0;
   769    769       }
   770    770     }else{
   771    771       /* Create a record from the argument register contents and insert it into
   772    772       ** the ephemeral table. */
   773    773       sqlite3VdbeAddOp3(v, OP_MakeRecord, regArg, nArg, regRec);
   774    774       sqlite3VdbeAddOp2(v, OP_NewRowid, ephemTab, regRowid);