/ Check-in [9f39cb5b]
Login

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

Overview
Comment:Fix "PRAGMA journal_mode" so that if it fails because there is a transaction open, it does not roll that transaction back.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | rollback-abort
Files: files | file ages | folders
SHA3-256: 9f39cb5b8195405f6aafacb04c411ff065ddefd0a234541fa2467f8e03bbcd25
User & Date: dan 2019-01-26 17:47:59
Context
2019-01-26
18:10
If a write statement fails with OE_Abort, but there is no statement journal, roll the entire transaction back instead. check-in: 75a8ed7a user: dan tags: rollback-abort
17:47
Fix "PRAGMA journal_mode" so that if it fails because there is a transaction open, it does not roll that transaction back. check-in: 9f39cb5b user: dan tags: rollback-abort
16:34
Roll back the transaction if a write statement fails with OE_Abort but there is no open statement transaction. check-in: d536be69 user: dan tags: rollback-abort
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/vacuum.c.

   126    126       int iIntoReg = 0;
   127    127       if( pInto && sqlite3ResolveSelfReference(pParse,0,0,pInto,0)==0 ){
   128    128         iIntoReg = ++pParse->nMem;
   129    129         sqlite3ExprCode(pParse, pInto, iIntoReg);
   130    130       }
   131    131       sqlite3VdbeAddOp2(v, OP_Vacuum, iDb, iIntoReg);
   132    132       sqlite3VdbeUsesBtree(v, iDb);
   133         -    assert( pParse==pParse->pToplevel || pParse->pToplevel==0 );
   134         -    pParse->mayAbort = pParse->isMultiWrite = 1;
   135    133     }
   136    134   build_vacuum_end:
   137    135     sqlite3ExprDelete(pParse->db, pInto);
   138    136     return;
   139    137   }
   140    138   
   141    139   /*

Changes to src/vdbeaux.c.

   740    740             break;
   741    741           }
   742    742   #ifndef SQLITE_OMIT_WAL
   743    743           case OP_Checkpoint:
   744    744   #endif
   745    745           case OP_Vacuum:
   746    746           case OP_JournalMode: {
          747  +          /* Neither VACUUM or "PRAGMA journal_mode" statements generate an
          748  +          ** OP_Transaction opcode. So setting usesStmtJournal does not cause
          749  +          ** either statement to actually open a statement journal. However,
          750  +          ** it does prevent them from rolling back an entire transaction
          751  +          ** if they fail because there is already a transaction open.  */
          752  +          p->usesStmtJournal = 1;
   747    753             p->readOnly = 0;
   748    754             p->bIsReader = 1;
   749    755             break;
   750    756           }
   751    757           case OP_Next:
   752    758           case OP_SorterNext: {
   753    759             pOp->p4.xAdvance = sqlite3BtreeNext;
................................................................................
  2199   2205     n = ROUND8(sizeof(Op)*p->nOp);              /* Bytes of opcode memory used */
  2200   2206     x.pSpace = &((u8*)p->aOp)[n];               /* Unused opcode memory */
  2201   2207     assert( EIGHT_BYTE_ALIGNMENT(x.pSpace) );
  2202   2208     x.nFree = ROUNDDOWN8(pParse->szOpAlloc - n);  /* Bytes of unused memory */
  2203   2209     assert( x.nFree>=0 );
  2204   2210     assert( EIGHT_BYTE_ALIGNMENT(&x.pSpace[x.nFree]) );
  2205   2211   
  2206         -  resolveP2Values(p, &nArg);
  2207   2212     p->usesStmtJournal = (u8)(pParse->isMultiWrite && pParse->mayAbort);
         2213  +  resolveP2Values(p, &nArg);
  2208   2214     if( pParse->explain && nMem<10 ){
  2209   2215       nMem = 10;
  2210   2216     }
  2211   2217     p->expired = 0;
  2212   2218   
  2213   2219     /* Memory for registers, parameters, cursor, etc, is allocated in one or two
  2214   2220     ** passes.  On the first pass, we try to reuse unused memory at the