/ Check-in [fd13dd95]
Login

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

Overview
Comment:Make SQLITE_BUSY_SNAPSHOT and SQLITE_BUSY_RECOVERY retryable, just as a plain SQLITE_BUSY is.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: fd13dd950d99fd1996860f7a5f220fdc89180194
User & Date: drh 2015-08-20 17:18:32
Context
2015-08-20
19:55
Add support for table-valued functions in the FROM clause implemented as virtual tables. check-in: 9b718b06 user: drh tags: trunk
17:18
Make SQLITE_BUSY_SNAPSHOT and SQLITE_BUSY_RECOVERY retryable, just as a plain SQLITE_BUSY is. check-in: fd13dd95 user: drh tags: trunk
2015-08-19
12:45
Simplification to error handling in addModuleArgument() in the virtual table processing. check-in: c573b0a1 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/vdbe.c.

   567    567     assert( p->magic==VDBE_MAGIC_RUN );  /* sqlite3_step() verifies this */
   568    568     sqlite3VdbeEnter(p);
   569    569     if( p->rc==SQLITE_NOMEM ){
   570    570       /* This happens if a malloc() inside a call to sqlite3_column_text() or
   571    571       ** sqlite3_column_text16() failed.  */
   572    572       goto no_mem;
   573    573     }
   574         -  assert( p->rc==SQLITE_OK || p->rc==SQLITE_BUSY );
          574  +  assert( p->rc==SQLITE_OK || (p->rc&0xff)==SQLITE_BUSY );
   575    575     assert( p->bIsReader || p->readOnly!=0 );
   576    576     p->rc = SQLITE_OK;
   577    577     p->iCurrentTime = 0;
   578    578     assert( p->explain==0 );
   579    579     p->pResultSet = 0;
   580    580     db->busyHandler.nBusy = 0;
   581    581     if( db->u1.isInterrupted ) goto abort_due_to_interrupt;
................................................................................
  3081   3081       rc = SQLITE_READONLY;
  3082   3082       goto abort_due_to_error;
  3083   3083     }
  3084   3084     pBt = db->aDb[pOp->p1].pBt;
  3085   3085   
  3086   3086     if( pBt ){
  3087   3087       rc = sqlite3BtreeBeginTrans(pBt, pOp->p2);
  3088         -    if( rc==SQLITE_BUSY ){
         3088  +    testcase( rc==SQLITE_BUSY_SNAPSHOT );
         3089  +    testcase( rc==SQLITE_BUSY_RECOVERY );
         3090  +    if( (rc&0xff)==SQLITE_BUSY ){
  3089   3091         p->pc = (int)(pOp - aOp);
  3090         -      p->rc = rc = SQLITE_BUSY;
         3092  +      p->rc = rc;
  3091   3093         goto vdbe_return;
  3092   3094       }
  3093   3095       if( rc!=SQLITE_OK ){
  3094   3096         goto abort_due_to_error;
  3095   3097       }
  3096   3098   
  3097   3099       if( pOp->p2 && p->usesStmtJournal 

Changes to src/vdbeapi.c.

   607    607     ** returned if this statement was compiled using the legacy 
   608    608     ** sqlite3_prepare() interface. According to the docs, this can only
   609    609     ** be one of the values in the first assert() below. Variable p->rc 
   610    610     ** contains the value that would be returned if sqlite3_finalize() 
   611    611     ** were called on statement p.
   612    612     */
   613    613     assert( rc==SQLITE_ROW  || rc==SQLITE_DONE   || rc==SQLITE_ERROR 
   614         -       || rc==SQLITE_BUSY || rc==SQLITE_MISUSE
          614  +       || (rc&0xff)==SQLITE_BUSY || rc==SQLITE_MISUSE
   615    615     );
   616    616     assert( (p->rc!=SQLITE_ROW && p->rc!=SQLITE_DONE) || p->rc==p->rcApp );
   617    617     if( p->isPrepareV2 && rc!=SQLITE_ROW && rc!=SQLITE_DONE ){
   618    618       /* If this statement was prepared using sqlite3_prepare_v2(), and an
   619    619       ** error has occurred, then return the error code in p->rc to the
   620    620       ** caller. Set the error code in the database handle to the same value.
   621    621       */