| Index: third_party/sqlite/amalgamation/sqlite3.c
|
| diff --git a/third_party/sqlite/amalgamation/sqlite3.c b/third_party/sqlite/amalgamation/sqlite3.c
|
| index 97d1ab9912109aba2d8c6268f4967449c2b4b28c..316bf94dbb8cf6e3a3be7986038498ebd67fb6eb 100644
|
| --- a/third_party/sqlite/amalgamation/sqlite3.c
|
| +++ b/third_party/sqlite/amalgamation/sqlite3.c
|
| @@ -2118,11 +2118,24 @@ struct sqlite3_mem_methods {
|
| ** following this call. The second parameter may be a NULL pointer, in
|
| ** which case the trigger setting is not reported back. </dd>
|
| **
|
| +** <dt>SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE</dt>
|
| +** <dd> Usually, when a database in wal mode is closed or detached from a
|
| +** database handle, SQLite checks if this will mean that there are now no
|
| +** connections at all to the database. If so, it performs a checkpoint
|
| +** operation before closing the connection. This option may be used to
|
| +** override this behaviour. The first parameter passed to this operation
|
| +** is an integer - non-zero to disable checkpoints-on-close, or zero (the
|
| +** default) to enable them. The second parameter is a pointer to an integer
|
| +** into which is written 0 or 1 to indicate whether checkpoints-on-close
|
| +** have been disabled - 0 if they are not disabled, 1 if they are.
|
| +** </dd>
|
| +**
|
| ** </dl>
|
| */
|
| #define SQLITE_DBCONFIG_LOOKASIDE 1001 /* void* int int */
|
| #define SQLITE_DBCONFIG_ENABLE_FKEY 1002 /* int int* */
|
| #define SQLITE_DBCONFIG_ENABLE_TRIGGER 1003 /* int int* */
|
| +#define SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE 1006 /* int int* */
|
|
|
|
|
| /*
|
| @@ -11170,7 +11183,7 @@ SQLITE_PRIVATE int sqlite3PagerOpen(
|
| int,
|
| void(*)(DbPage*)
|
| );
|
| -SQLITE_PRIVATE int sqlite3PagerClose(Pager *pPager);
|
| +SQLITE_PRIVATE int sqlite3PagerClose(Pager *pPager, sqlite3*);
|
| SQLITE_PRIVATE int sqlite3PagerReadFileheader(Pager*, int, unsigned char*);
|
|
|
| /* Functions used to configure a Pager object. */
|
| @@ -12132,6 +12145,7 @@ struct sqlite3 {
|
| #define SQLITE_VdbeEQP 0x04000000 /* Debug EXPLAIN QUERY PLAN */
|
| #define SQLITE_Vacuum 0x08000000 /* Currently in a VACUUM */
|
| #define SQLITE_CellSizeCk 0x10000000 /* Check btree cell sizes on load */
|
| +#define SQLITE_NoCkptOnClose 0x80000000 /* No checkpoint on close()/DETACH */
|
|
|
|
|
| /*
|
| @@ -47488,7 +47502,7 @@ static void pagerFreeMapHdrs(Pager *pPager){
|
| ** a hot journal may be left in the filesystem but no error is returned
|
| ** to the caller.
|
| */
|
| -SQLITE_PRIVATE int sqlite3PagerClose(Pager *pPager){
|
| +SQLITE_PRIVATE int sqlite3PagerClose(Pager *pPager, sqlite3 *db){
|
| u8 *pTmp = (u8 *)pPager->pTmpSpace;
|
|
|
| assert( assert_pager_state(pPager) );
|
| @@ -47498,7 +47512,9 @@ SQLITE_PRIVATE int sqlite3PagerClose(Pager *pPager){
|
| /* pPager->errCode = 0; */
|
| pPager->exclusiveMode = 0;
|
| #ifndef SQLITE_OMIT_WAL
|
| - sqlite3WalClose(pPager->pWal, pPager->ckptSyncFlags, pPager->pageSize, pTmp);
|
| + sqlite3WalClose(pPager->pWal, pPager->ckptSyncFlags, pPager->pageSize,
|
| + (db && (db->flags & SQLITE_NoCkptOnClose) ? 0 : pTmp)
|
| + );
|
| pPager->pWal = 0;
|
| #endif
|
| pager_reset(pPager);
|
| @@ -57623,7 +57639,7 @@ SQLITE_PRIVATE int sqlite3BtreeOpen(
|
| btree_open_out:
|
| if( rc!=SQLITE_OK ){
|
| if( pBt && pBt->pPager ){
|
| - sqlite3PagerClose(pBt->pPager);
|
| + sqlite3PagerClose(pBt->pPager, 0);
|
| }
|
| sqlite3_free(pBt);
|
| sqlite3_free(p);
|
| @@ -57764,7 +57780,7 @@ SQLITE_PRIVATE int sqlite3BtreeClose(Btree *p){
|
| ** Clean out and delete the BtShared object.
|
| */
|
| assert( !pBt->pCursor );
|
| - sqlite3PagerClose(pBt->pPager);
|
| + sqlite3PagerClose(pBt->pPager, p->db);
|
| if( pBt->xFreeSchema && pBt->pSchema ){
|
| pBt->xFreeSchema(pBt->pSchema);
|
| }
|
| @@ -132970,6 +132986,7 @@ SQLITE_API int SQLITE_CDECL sqlite3_db_config(sqlite3 *db, int op, ...){
|
| } aFlagOp[] = {
|
| { SQLITE_DBCONFIG_ENABLE_FKEY, SQLITE_ForeignKeys },
|
| { SQLITE_DBCONFIG_ENABLE_TRIGGER, SQLITE_EnableTrigger },
|
| + { SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE, SQLITE_NoCkptOnClose },
|
| };
|
| unsigned int i;
|
| rc = SQLITE_ERROR; /* IMP: R-42790-23372 */
|
|
|