Fossil SCM
Extra effort to close all prepared statements prior to exiting, in order to avoid dangling journal files.
Commit
7680076966d4b6bb4d0616fdc94b70fab5cea70539a68ee8ff946e23f41b5164
Parent
9d0bfcb3d8b7514…
2 files changed
+2
-1
+9
+2
-1
| --- src/backoffice.c | ||
| +++ src/backoffice.c | ||
| @@ -222,11 +222,12 @@ | ||
| 222 | 222 | x.idNext = 0; |
| 223 | 223 | x.tmNext = 0; |
| 224 | 224 | backofficeWriteLease(&x); |
| 225 | 225 | db_end_transaction(0); |
| 226 | 226 | if( g.fAnyTrace ){ |
| 227 | - fprintf(stderr, "/***** Begin Backoffice Processing *****/\n"); | |
| 227 | + fprintf(stderr, "/***** Begin Backoffice Processing %d *****/\n", | |
| 228 | + getpid()); | |
| 228 | 229 | } |
| 229 | 230 | backoffice_work(); |
| 230 | 231 | break; |
| 231 | 232 | } |
| 232 | 233 | /* This process needs to queue up and wait for the current lease |
| 233 | 234 |
| --- src/backoffice.c | |
| +++ src/backoffice.c | |
| @@ -222,11 +222,12 @@ | |
| 222 | x.idNext = 0; |
| 223 | x.tmNext = 0; |
| 224 | backofficeWriteLease(&x); |
| 225 | db_end_transaction(0); |
| 226 | if( g.fAnyTrace ){ |
| 227 | fprintf(stderr, "/***** Begin Backoffice Processing *****/\n"); |
| 228 | } |
| 229 | backoffice_work(); |
| 230 | break; |
| 231 | } |
| 232 | /* This process needs to queue up and wait for the current lease |
| 233 |
| --- src/backoffice.c | |
| +++ src/backoffice.c | |
| @@ -222,11 +222,12 @@ | |
| 222 | x.idNext = 0; |
| 223 | x.tmNext = 0; |
| 224 | backofficeWriteLease(&x); |
| 225 | db_end_transaction(0); |
| 226 | if( g.fAnyTrace ){ |
| 227 | fprintf(stderr, "/***** Begin Backoffice Processing %d *****/\n", |
| 228 | getpid()); |
| 229 | } |
| 230 | backoffice_work(); |
| 231 | break; |
| 232 | } |
| 233 | /* This process needs to queue up and wait for the current lease |
| 234 |
M
src/db.c
+9
| --- src/db.c | ||
| +++ src/db.c | ||
| @@ -339,11 +339,18 @@ | ||
| 339 | 339 | } |
| 340 | 340 | rc = sqlite3_prepare_v3(g.db, zSql, -1, prepFlags, &pStmt->pStmt, 0); |
| 341 | 341 | if( rc!=0 && (flags & DB_PREPARE_IGNORE_ERROR)==0 ){ |
| 342 | 342 | db_err("%s\n%s", sqlite3_errmsg(g.db), zSql); |
| 343 | 343 | } |
| 344 | +#if 1 | |
| 345 | + pStmt->pNext = db.pAllStmt; | |
| 346 | + pStmt->pPrev = 0; | |
| 347 | + if( db.pAllStmt ) db.pAllStmt->pPrev = pStmt; | |
| 348 | + db.pAllStmt = pStmt; | |
| 349 | +#else | |
| 344 | 350 | pStmt->pNext = pStmt->pPrev = 0; |
| 351 | +#endif | |
| 345 | 352 | pStmt->nStep = 0; |
| 346 | 353 | pStmt->rc = rc; |
| 347 | 354 | return rc; |
| 348 | 355 | } |
| 349 | 356 | int db_prepare(Stmt *pStmt, const char *zFormat, ...){ |
| @@ -366,14 +373,16 @@ | ||
| 366 | 373 | int rc = SQLITE_OK; |
| 367 | 374 | if( blob_size(&pStmt->sql)==0 ){ |
| 368 | 375 | va_list ap; |
| 369 | 376 | va_start(ap, zFormat); |
| 370 | 377 | rc = db_vprepare(pStmt, DB_PREPARE_PERSISTENT, zFormat, ap); |
| 378 | +#if 0 | |
| 371 | 379 | pStmt->pNext = db.pAllStmt; |
| 372 | 380 | pStmt->pPrev = 0; |
| 373 | 381 | if( db.pAllStmt ) db.pAllStmt->pPrev = pStmt; |
| 374 | 382 | db.pAllStmt = pStmt; |
| 383 | +#endif | |
| 375 | 384 | va_end(ap); |
| 376 | 385 | } |
| 377 | 386 | return rc; |
| 378 | 387 | } |
| 379 | 388 | |
| 380 | 389 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -339,11 +339,18 @@ | |
| 339 | } |
| 340 | rc = sqlite3_prepare_v3(g.db, zSql, -1, prepFlags, &pStmt->pStmt, 0); |
| 341 | if( rc!=0 && (flags & DB_PREPARE_IGNORE_ERROR)==0 ){ |
| 342 | db_err("%s\n%s", sqlite3_errmsg(g.db), zSql); |
| 343 | } |
| 344 | pStmt->pNext = pStmt->pPrev = 0; |
| 345 | pStmt->nStep = 0; |
| 346 | pStmt->rc = rc; |
| 347 | return rc; |
| 348 | } |
| 349 | int db_prepare(Stmt *pStmt, const char *zFormat, ...){ |
| @@ -366,14 +373,16 @@ | |
| 366 | int rc = SQLITE_OK; |
| 367 | if( blob_size(&pStmt->sql)==0 ){ |
| 368 | va_list ap; |
| 369 | va_start(ap, zFormat); |
| 370 | rc = db_vprepare(pStmt, DB_PREPARE_PERSISTENT, zFormat, ap); |
| 371 | pStmt->pNext = db.pAllStmt; |
| 372 | pStmt->pPrev = 0; |
| 373 | if( db.pAllStmt ) db.pAllStmt->pPrev = pStmt; |
| 374 | db.pAllStmt = pStmt; |
| 375 | va_end(ap); |
| 376 | } |
| 377 | return rc; |
| 378 | } |
| 379 | |
| 380 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -339,11 +339,18 @@ | |
| 339 | } |
| 340 | rc = sqlite3_prepare_v3(g.db, zSql, -1, prepFlags, &pStmt->pStmt, 0); |
| 341 | if( rc!=0 && (flags & DB_PREPARE_IGNORE_ERROR)==0 ){ |
| 342 | db_err("%s\n%s", sqlite3_errmsg(g.db), zSql); |
| 343 | } |
| 344 | #if 1 |
| 345 | pStmt->pNext = db.pAllStmt; |
| 346 | pStmt->pPrev = 0; |
| 347 | if( db.pAllStmt ) db.pAllStmt->pPrev = pStmt; |
| 348 | db.pAllStmt = pStmt; |
| 349 | #else |
| 350 | pStmt->pNext = pStmt->pPrev = 0; |
| 351 | #endif |
| 352 | pStmt->nStep = 0; |
| 353 | pStmt->rc = rc; |
| 354 | return rc; |
| 355 | } |
| 356 | int db_prepare(Stmt *pStmt, const char *zFormat, ...){ |
| @@ -366,14 +373,16 @@ | |
| 373 | int rc = SQLITE_OK; |
| 374 | if( blob_size(&pStmt->sql)==0 ){ |
| 375 | va_list ap; |
| 376 | va_start(ap, zFormat); |
| 377 | rc = db_vprepare(pStmt, DB_PREPARE_PERSISTENT, zFormat, ap); |
| 378 | #if 0 |
| 379 | pStmt->pNext = db.pAllStmt; |
| 380 | pStmt->pPrev = 0; |
| 381 | if( db.pAllStmt ) db.pAllStmt->pPrev = pStmt; |
| 382 | db.pAllStmt = pStmt; |
| 383 | #endif |
| 384 | va_end(ap); |
| 385 | } |
| 386 | return rc; |
| 387 | } |
| 388 | |
| 389 |