Fossil

Check-in [42d821a7]
Login

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

Overview
Comment:Always unlink prepared statements from the Stmt list prior to finalizing them. This prevents an error in db_finalize() from triggering a rollback and hence a recursive call to sqlite3_finalize().
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | forum-v2
Files: files | file ages | folders
SHA3-256: 42d821a714d092a86dfcdf6b815300b7d5ce228f5e42c10fe8658c4be8f2881d
User & Date: drh 2018-07-24 22:01:12.542
Context
2018-07-24
22:05
Update the built-in SQLite to the latest trunk version that includes enhancements that allow a CREATE INDEX statement to occur without interrupting a running SELECT statement. This is important for correct operation of "fossil rebuild" since the forumpost table is created on demand in the middle of a query over the blob table. ... (check-in: e2d87cdd user: drh tags: forum-v2)
22:01
Always unlink prepared statements from the Stmt list prior to finalizing them. This prevents an error in db_finalize() from triggering a rollback and hence a recursive call to sqlite3_finalize(). ... (check-in: 42d821a7 user: drh tags: forum-v2)
19:44
Work toward pages to enter forum posts. This is an incremental check-in to save state and definitely does not work. ... (check-in: 7b5099ea user: drh tags: forum-v2)
Changes
Unified Diff Show Whitespace Changes Patch
Changes to src/db.c.
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511





512
513
514
515
516
517
518
  db_stats(pStmt);
  rc = sqlite3_reset(pStmt->pStmt);
  db_check_result(rc);
  return rc;
}
int db_finalize(Stmt *pStmt){
  int rc;
  db_stats(pStmt);
  blob_reset(&pStmt->sql);
  rc = sqlite3_finalize(pStmt->pStmt);
  db_check_result(rc);
  pStmt->pStmt = 0;
  if( pStmt->pNext ){
    pStmt->pNext->pPrev = pStmt->pPrev;
  }
  if( pStmt->pPrev ){
    pStmt->pPrev->pNext = pStmt->pNext;
  }else if( db.pAllStmt==pStmt ){
    db.pAllStmt = pStmt->pNext;
  }
  pStmt->pNext = 0;
  pStmt->pPrev = 0;





  return rc;
}

/*
** Return the rowid of the most recent insert
*/
int db_last_insert_rowid(void){







<
<
<
<
<










>
>
>
>
>







490
491
492
493
494
495
496





497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
  db_stats(pStmt);
  rc = sqlite3_reset(pStmt->pStmt);
  db_check_result(rc);
  return rc;
}
int db_finalize(Stmt *pStmt){
  int rc;





  if( pStmt->pNext ){
    pStmt->pNext->pPrev = pStmt->pPrev;
  }
  if( pStmt->pPrev ){
    pStmt->pPrev->pNext = pStmt->pNext;
  }else if( db.pAllStmt==pStmt ){
    db.pAllStmt = pStmt->pNext;
  }
  pStmt->pNext = 0;
  pStmt->pPrev = 0;
  db_stats(pStmt);
  blob_reset(&pStmt->sql);
  rc = sqlite3_finalize(pStmt->pStmt);
  db_check_result(rc);
  pStmt->pStmt = 0;
  return rc;
}

/*
** Return the rowid of the most recent insert
*/
int db_last_insert_rowid(void){