mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-08 14:02:16 +03:00
Merge the latest trunk changes into the sessions branch.
FossilOrigin-Name: 832886b1e6edb916d9824924c7d88202f4eb1969
This commit is contained in:
@@ -977,6 +977,8 @@ static int fts3InitVtab(
|
|||||||
p->nMaxPendingData = FTS3_MAX_PENDING_DATA;
|
p->nMaxPendingData = FTS3_MAX_PENDING_DATA;
|
||||||
p->bHasDocsize = (isFts4 && bNoDocsize==0);
|
p->bHasDocsize = (isFts4 && bNoDocsize==0);
|
||||||
p->bHasStat = isFts4;
|
p->bHasStat = isFts4;
|
||||||
|
TESTONLY( p->inTransaction = -1 );
|
||||||
|
TESTONLY( p->mxSavepoint = -1 );
|
||||||
fts3HashInit(&p->pendingTerms, FTS3_HASH_STRING, 1);
|
fts3HashInit(&p->pendingTerms, FTS3_HASH_STRING, 1);
|
||||||
|
|
||||||
/* Fill in the zName and zDb fields of the vtab structure. */
|
/* Fill in the zName and zDb fields of the vtab structure. */
|
||||||
@@ -3274,7 +3276,11 @@ static int fts3SyncMethod(sqlite3_vtab *pVtab){
|
|||||||
*/
|
*/
|
||||||
static int fts3BeginMethod(sqlite3_vtab *pVtab){
|
static int fts3BeginMethod(sqlite3_vtab *pVtab){
|
||||||
UNUSED_PARAMETER(pVtab);
|
UNUSED_PARAMETER(pVtab);
|
||||||
assert( ((Fts3Table *)pVtab)->nPendingData==0 );
|
TESTONLY( Fts3Table *p = (Fts3Table*)pVtab );
|
||||||
|
assert( p->nPendingData==0 );
|
||||||
|
assert( p->inTransaction!=1 );
|
||||||
|
TESTONLY( p->inTransaction = 1 );
|
||||||
|
TESTONLY( p->mxSavepoint = -1; );
|
||||||
return SQLITE_OK;
|
return SQLITE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3285,7 +3291,11 @@ static int fts3BeginMethod(sqlite3_vtab *pVtab){
|
|||||||
*/
|
*/
|
||||||
static int fts3CommitMethod(sqlite3_vtab *pVtab){
|
static int fts3CommitMethod(sqlite3_vtab *pVtab){
|
||||||
UNUSED_PARAMETER(pVtab);
|
UNUSED_PARAMETER(pVtab);
|
||||||
assert( ((Fts3Table *)pVtab)->nPendingData==0 );
|
TESTONLY( Fts3Table *p = (Fts3Table*)pVtab );
|
||||||
|
assert( p->nPendingData==0 );
|
||||||
|
assert( p->inTransaction!=0 );
|
||||||
|
TESTONLY( p->inTransaction = 0 );
|
||||||
|
TESTONLY( p->mxSavepoint = -1; );
|
||||||
return SQLITE_OK;
|
return SQLITE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3294,7 +3304,11 @@ static int fts3CommitMethod(sqlite3_vtab *pVtab){
|
|||||||
** hash-table. Any changes made to the database are reverted by SQLite.
|
** hash-table. Any changes made to the database are reverted by SQLite.
|
||||||
*/
|
*/
|
||||||
static int fts3RollbackMethod(sqlite3_vtab *pVtab){
|
static int fts3RollbackMethod(sqlite3_vtab *pVtab){
|
||||||
sqlite3Fts3PendingTermsClear((Fts3Table *)pVtab);
|
Fts3Table *p = (Fts3Table*)pVtab;
|
||||||
|
sqlite3Fts3PendingTermsClear(p);
|
||||||
|
assert( p->inTransaction!=0 );
|
||||||
|
TESTONLY( p->inTransaction = 0 );
|
||||||
|
TESTONLY( p->mxSavepoint = -1; );
|
||||||
return SQLITE_OK;
|
return SQLITE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3650,13 +3664,29 @@ static int fts3RenameMethod(
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int fts3SavepointMethod(sqlite3_vtab *pVtab, int iSavepoint){
|
static int fts3SavepointMethod(sqlite3_vtab *pVtab, int iSavepoint){
|
||||||
return sqlite3Fts3PendingTermsFlush((Fts3Table *)pVtab);
|
Fts3Table *p = (Fts3Table*)pVtab;
|
||||||
|
UNUSED_PARAMETER(iSavepoint);
|
||||||
|
assert( p->inTransaction );
|
||||||
|
assert( p->mxSavepoint < iSavepoint );
|
||||||
|
TESTONLY( p->mxSavepoint = iSavepoint );
|
||||||
|
return sqlite3Fts3PendingTermsFlush(p);
|
||||||
}
|
}
|
||||||
static int fts3ReleaseMethod(sqlite3_vtab *pVtab, int iSavepoint){
|
static int fts3ReleaseMethod(sqlite3_vtab *pVtab, int iSavepoint){
|
||||||
|
TESTONLY( Fts3Table *p = (Fts3Table*)pVtab );
|
||||||
|
UNUSED_PARAMETER(iSavepoint);
|
||||||
|
UNUSED_PARAMETER(pVtab);
|
||||||
|
assert( p->inTransaction );
|
||||||
|
assert( p->mxSavepoint >= iSavepoint );
|
||||||
|
TESTONLY( p->mxSavepoint = iSavepoint-1 );
|
||||||
return SQLITE_OK;
|
return SQLITE_OK;
|
||||||
}
|
}
|
||||||
static int fts3RollbackToMethod(sqlite3_vtab *pVtab, int iSavepoint){
|
static int fts3RollbackToMethod(sqlite3_vtab *pVtab, int iSavepoint){
|
||||||
sqlite3Fts3PendingTermsClear((Fts3Table *)pVtab);
|
Fts3Table *p = (Fts3Table*)pVtab;
|
||||||
|
UNUSED_PARAMETER(iSavepoint);
|
||||||
|
assert( p->inTransaction );
|
||||||
|
assert( p->mxSavepoint >= iSavepoint );
|
||||||
|
TESTONLY( p->mxSavepoint = iSavepoint );
|
||||||
|
sqlite3Fts3PendingTermsClear(p);
|
||||||
return SQLITE_OK;
|
return SQLITE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -92,12 +92,32 @@ typedef unsigned char u8; /* 1-byte (or larger) unsigned integer */
|
|||||||
typedef short int i16; /* 2-byte (or larger) signed integer */
|
typedef short int i16; /* 2-byte (or larger) signed integer */
|
||||||
typedef unsigned int u32; /* 4-byte unsigned integer */
|
typedef unsigned int u32; /* 4-byte unsigned integer */
|
||||||
typedef sqlite3_uint64 u64; /* 8-byte unsigned integer */
|
typedef sqlite3_uint64 u64; /* 8-byte unsigned integer */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Macro used to suppress compiler warnings for unused parameters.
|
** Macro used to suppress compiler warnings for unused parameters.
|
||||||
*/
|
*/
|
||||||
#define UNUSED_PARAMETER(x) (void)(x)
|
#define UNUSED_PARAMETER(x) (void)(x)
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Activate assert() only if SQLITE_TEST is enabled.
|
||||||
|
*/
|
||||||
|
#if !defined(NDEBUG) && !defined(SQLITE_DEBUG)
|
||||||
|
# define NDEBUG 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
** The TESTONLY macro is used to enclose variable declarations or
|
||||||
|
** other bits of code that are needed to support the arguments
|
||||||
|
** within testcase() and assert() macros.
|
||||||
|
*/
|
||||||
|
#if defined(SQLITE_DEBUG) || defined(SQLITE_COVERAGE_TEST)
|
||||||
|
# define TESTONLY(X) X
|
||||||
|
#else
|
||||||
|
# define TESTONLY(X)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* SQLITE_AMALGAMATION */
|
||||||
|
|
||||||
typedef struct Fts3Table Fts3Table;
|
typedef struct Fts3Table Fts3Table;
|
||||||
typedef struct Fts3Cursor Fts3Cursor;
|
typedef struct Fts3Cursor Fts3Cursor;
|
||||||
typedef struct Fts3Expr Fts3Expr;
|
typedef struct Fts3Expr Fts3Expr;
|
||||||
@@ -151,6 +171,16 @@ struct Fts3Table {
|
|||||||
int nPendingData;
|
int nPendingData;
|
||||||
sqlite_int64 iPrevDocid;
|
sqlite_int64 iPrevDocid;
|
||||||
Fts3Hash pendingTerms;
|
Fts3Hash pendingTerms;
|
||||||
|
|
||||||
|
#if defined(SQLITE_DEBUG)
|
||||||
|
/* State variables used for validating that the transaction control
|
||||||
|
** methods of the virtual table are called at appropriate times. These
|
||||||
|
** values do not contribution to the FTS computation; they are used for
|
||||||
|
** verifying the SQLite core.
|
||||||
|
*/
|
||||||
|
int inTransaction; /* True after xBegin but before xCommit/xRollback */
|
||||||
|
int mxSavepoint; /* Largest valid xSavepoint integer */
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -342,6 +342,7 @@ static int fts3auxFilterMethod(
|
|||||||
int isScan;
|
int isScan;
|
||||||
|
|
||||||
UNUSED_PARAMETER(nVal);
|
UNUSED_PARAMETER(nVal);
|
||||||
|
UNUSED_PARAMETER(idxStr);
|
||||||
|
|
||||||
assert( idxStr==0 );
|
assert( idxStr==0 );
|
||||||
assert( idxNum==FTS4AUX_EQ_CONSTRAINT || idxNum==0
|
assert( idxNum==FTS4AUX_EQ_CONSTRAINT || idxNum==0
|
||||||
@@ -459,7 +460,10 @@ int sqlite3Fts3InitAux(sqlite3 *db){
|
|||||||
0, /* xCommit */
|
0, /* xCommit */
|
||||||
0, /* xRollback */
|
0, /* xRollback */
|
||||||
0, /* xFindFunction */
|
0, /* xFindFunction */
|
||||||
0 /* xRename */
|
0, /* xRename */
|
||||||
|
0, /* xSavepoint */
|
||||||
|
0, /* xRelease */
|
||||||
|
0 /* xRollbackTo */
|
||||||
};
|
};
|
||||||
int rc; /* Return code */
|
int rc; /* Return code */
|
||||||
|
|
||||||
|
@@ -2849,7 +2849,7 @@ static int rtreeRename(sqlite3_vtab *pVtab, const char *zNewName){
|
|||||||
}
|
}
|
||||||
|
|
||||||
static sqlite3_module rtreeModule = {
|
static sqlite3_module rtreeModule = {
|
||||||
0, /* iVersion */
|
0, /* iVersion */
|
||||||
rtreeCreate, /* xCreate - create a table */
|
rtreeCreate, /* xCreate - create a table */
|
||||||
rtreeConnect, /* xConnect - connect to an existing table */
|
rtreeConnect, /* xConnect - connect to an existing table */
|
||||||
rtreeBestIndex, /* xBestIndex - Determine search strategy */
|
rtreeBestIndex, /* xBestIndex - Determine search strategy */
|
||||||
@@ -2868,7 +2868,10 @@ static sqlite3_module rtreeModule = {
|
|||||||
0, /* xCommit - commit transaction */
|
0, /* xCommit - commit transaction */
|
||||||
0, /* xRollback - rollback transaction */
|
0, /* xRollback - rollback transaction */
|
||||||
0, /* xFindFunction - function overloading */
|
0, /* xFindFunction - function overloading */
|
||||||
rtreeRename /* xRename - rename the table */
|
rtreeRename, /* xRename - rename the table */
|
||||||
|
0, /* xSavepoint */
|
||||||
|
0, /* xRelease */
|
||||||
|
0 /* xRollbackTo */
|
||||||
};
|
};
|
||||||
|
|
||||||
static int rtreeSqlInit(
|
static int rtreeSqlInit(
|
||||||
|
48
manifest
48
manifest
@@ -1,5 +1,5 @@
|
|||||||
C Merge\sall\sthe\slatest\strunk\schanges\sinto\sthe\ssessions\sbranch,\sespecially\nthe\sdisappearing\sWAL\stransaction\sfix.
|
C Merge\sthe\slatest\strunk\schanges\sinto\sthe\ssessions\sbranch.
|
||||||
D 2011-05-19T02:48:46.609
|
D 2011-05-30T13:39:20.980
|
||||||
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
||||||
F Makefile.in 11dcc00a8d0e5202def00e81732784fb0cc4fe1d
|
F Makefile.in 11dcc00a8d0e5202def00e81732784fb0cc4fe1d
|
||||||
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
||||||
@@ -61,10 +61,10 @@ F ext/fts2/mkfts2amal.tcl 974d5d438cb3f7c4a652639262f82418c1e4cff0
|
|||||||
F ext/fts3/README.syntax a19711dc5458c20734b8e485e75fb1981ec2427a
|
F ext/fts3/README.syntax a19711dc5458c20734b8e485e75fb1981ec2427a
|
||||||
F ext/fts3/README.tokenizers 998756696647400de63d5ba60e9655036cb966e9
|
F ext/fts3/README.tokenizers 998756696647400de63d5ba60e9655036cb966e9
|
||||||
F ext/fts3/README.txt 8c18f41574404623b76917b9da66fcb0ab38328d
|
F ext/fts3/README.txt 8c18f41574404623b76917b9da66fcb0ab38328d
|
||||||
F ext/fts3/fts3.c 18c2a079ba2b9154b7485fd39d1a6d12b5872a76
|
F ext/fts3/fts3.c b3a10a1a320aaeb56a1dd6710bf09eb5c2370839
|
||||||
F ext/fts3/fts3.h 3a10a0af180d502cecc50df77b1b22df142817fe
|
F ext/fts3/fts3.h 3a10a0af180d502cecc50df77b1b22df142817fe
|
||||||
F ext/fts3/fts3Int.h 05d145152620e7849c452bd919f2cc3e2d75309f
|
F ext/fts3/fts3Int.h c8c0011c5e5b3a7703376ea6cd7deb91cfb96a06
|
||||||
F ext/fts3/fts3_aux.c 9e931f55eed8498dafe7bc1160f10cbb1a652fdf
|
F ext/fts3/fts3_aux.c 97c960b1b0d371c08eae6b8565dfac619eb9d979
|
||||||
F ext/fts3/fts3_expr.c 5f49e0deaf723724b08100bb3ff40aab02ad0c93
|
F ext/fts3/fts3_expr.c 5f49e0deaf723724b08100bb3ff40aab02ad0c93
|
||||||
F ext/fts3/fts3_hash.c 3c8f6387a4a7f5305588b203fa7c887d753e1f1c
|
F ext/fts3/fts3_hash.c 3c8f6387a4a7f5305588b203fa7c887d753e1f1c
|
||||||
F ext/fts3/fts3_hash.h 8331fb2206c609f9fc4c4735b9ab5ad6137c88ec
|
F ext/fts3/fts3_hash.h 8331fb2206c609f9fc4c4735b9ab5ad6137c88ec
|
||||||
@@ -82,7 +82,7 @@ F ext/icu/README.txt bf8461d8cdc6b8f514c080e4e10dc3b2bbdfefa9
|
|||||||
F ext/icu/icu.c eb9ae1d79046bd7871aa97ee6da51eb770134b5a
|
F ext/icu/icu.c eb9ae1d79046bd7871aa97ee6da51eb770134b5a
|
||||||
F ext/icu/sqliteicu.h 728867a802baa5a96de7495e9689a8e01715ef37
|
F ext/icu/sqliteicu.h 728867a802baa5a96de7495e9689a8e01715ef37
|
||||||
F ext/rtree/README 6315c0d73ebf0ec40dedb5aa0e942bc8b54e3761
|
F ext/rtree/README 6315c0d73ebf0ec40dedb5aa0e942bc8b54e3761
|
||||||
F ext/rtree/rtree.c 2445bec932f58f8f4fe9de49a63bd6bf24db82d6
|
F ext/rtree/rtree.c 4b8438444927191b55de18e00df43b2e02aacbda
|
||||||
F ext/rtree/rtree.h 834dbcb82dc85b2481cde6a07cdadfddc99e9b9e
|
F ext/rtree/rtree.h 834dbcb82dc85b2481cde6a07cdadfddc99e9b9e
|
||||||
F ext/rtree/rtree1.test 28e1b8da4da98093ce3210187434dd760a8d89d8
|
F ext/rtree/rtree1.test 28e1b8da4da98093ce3210187434dd760a8d89d8
|
||||||
F ext/rtree/rtree2.test acbb3a4ce0f4fbc2c304d2b4b784cfa161856bba
|
F ext/rtree/rtree2.test acbb3a4ce0f4fbc2c304d2b4b784cfa161856bba
|
||||||
@@ -175,10 +175,10 @@ F src/os_common.h a8f95b81eca8a1ab8593d23e94f8a35f35d4078f
|
|||||||
F src/os_os2.c 4a75888ba3dfc820ad5e8177025972d74d7f2440
|
F src/os_os2.c 4a75888ba3dfc820ad5e8177025972d74d7f2440
|
||||||
F src/os_unix.c 6d4a58d81ad4b782406519f3790202f330e89bb7
|
F src/os_unix.c 6d4a58d81ad4b782406519f3790202f330e89bb7
|
||||||
F src/os_win.c 218b899469e570d46eb8147c2383075f7c026230
|
F src/os_win.c 218b899469e570d46eb8147c2383075f7c026230
|
||||||
F src/pager.c 4b2358556c88660a94a4560de95dd728911e00fd
|
F src/pager.c 120550e7ef01dafaa2cbb4a0528c0d87c8f12b41
|
||||||
F src/pager.h 3f8c783de1d4706b40b1ac15b64f5f896bcc78d1
|
F src/pager.h 3f8c783de1d4706b40b1ac15b64f5f896bcc78d1
|
||||||
F src/parse.y 12b7ebd61ea54f0e1b1083ff69cc2c8ce9353d58
|
F src/parse.y 12b7ebd61ea54f0e1b1083ff69cc2c8ce9353d58
|
||||||
F src/pcache.c 09d38c44ab275db581f7a2f6ff8b9bc7f8c0faaa
|
F src/pcache.c 49e718c095810c6b3334e3a6d89970aceaddefce
|
||||||
F src/pcache.h c683390d50f856d4cd8e24342ae62027d1bb6050
|
F src/pcache.h c683390d50f856d4cd8e24342ae62027d1bb6050
|
||||||
F src/pcache1.c d548e31beafa792d1994b663a29a5303569efc4e
|
F src/pcache1.c d548e31beafa792d1994b663a29a5303569efc4e
|
||||||
F src/pragma.c 9e778decc3ee9bcaf88904b4a3b0a4360aaf0eab
|
F src/pragma.c 9e778decc3ee9bcaf88904b4a3b0a4360aaf0eab
|
||||||
@@ -189,9 +189,9 @@ F src/resolve.c 1c0f32b64f8e3f555fe1f732f9d6f501a7f05706
|
|||||||
F src/rowset.c 69afa95a97c524ba6faf3805e717b5b7ae85a697
|
F src/rowset.c 69afa95a97c524ba6faf3805e717b5b7ae85a697
|
||||||
F src/select.c d9d440809025a58547e39f4f268c2a296bfb56ff
|
F src/select.c d9d440809025a58547e39f4f268c2a296bfb56ff
|
||||||
F src/shell.c decd04236a7ef26be5ef46d4ea963044bfad9a48
|
F src/shell.c decd04236a7ef26be5ef46d4ea963044bfad9a48
|
||||||
F src/sqlite.h.in b851102bb0840bf6d4dde5d6690c2ad127a65ade
|
F src/sqlite.h.in 6e087deaec87d358aa4027545ef7454e427b5619
|
||||||
F src/sqlite3ext.h c90bd5507099f62043832d73f6425d8d5c5da754
|
F src/sqlite3ext.h c90bd5507099f62043832d73f6425d8d5c5da754
|
||||||
F src/sqliteInt.h 2fb482cff778112e6b2797226f30f3862a627468
|
F src/sqliteInt.h 38481431b379b468f7bd282d2e318aed4b56d860
|
||||||
F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d
|
F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d
|
||||||
F src/status.c 7ac64842c86cec2fc1a1d0e5c16d3beb8ad332bf
|
F src/status.c 7ac64842c86cec2fc1a1d0e5c16d3beb8ad332bf
|
||||||
F src/table.c 2cd62736f845d82200acfa1287e33feb3c15d62e
|
F src/table.c 2cd62736f845d82200acfa1287e33feb3c15d62e
|
||||||
@@ -210,7 +210,7 @@ F src/test_autoext.c 30e7bd98ab6d70a62bb9ba572e4c7df347fe645e
|
|||||||
F src/test_backup.c c129c91127e9b46e335715ae2e75756e25ba27de
|
F src/test_backup.c c129c91127e9b46e335715ae2e75756e25ba27de
|
||||||
F src/test_btree.c 47cd771250f09cdc6e12dda5bc71bc0b3abc96e2
|
F src/test_btree.c 47cd771250f09cdc6e12dda5bc71bc0b3abc96e2
|
||||||
F src/test_config.c 2794d55f27c7faa6c8203b15e634e7103953ddcc
|
F src/test_config.c 2794d55f27c7faa6c8203b15e634e7103953ddcc
|
||||||
F src/test_demovfs.c 938d0f595f8bd310076e1c06cf7885a01ce7ce01
|
F src/test_demovfs.c 20a4975127993f4959890016ae9ce5535a880094
|
||||||
F src/test_devsym.c e7498904e72ba7491d142d5c83b476c4e76993bc
|
F src/test_devsym.c e7498904e72ba7491d142d5c83b476c4e76993bc
|
||||||
F src/test_func.c cbdec5cededa0761daedde5baf06004a9bf416b5
|
F src/test_func.c cbdec5cededa0761daedde5baf06004a9bf416b5
|
||||||
F src/test_fuzzer.c f884f6f32e8513d34248d6e1ac8a32047fead254
|
F src/test_fuzzer.c f884f6f32e8513d34248d6e1ac8a32047fead254
|
||||||
@@ -218,10 +218,10 @@ F src/test_hexio.c c4773049603151704a6ab25ac5e936b5109caf5a
|
|||||||
F src/test_init.c 5d624ffd0409d424cf9adbfe1f056b200270077c
|
F src/test_init.c 5d624ffd0409d424cf9adbfe1f056b200270077c
|
||||||
F src/test_intarray.c d879bbf8e4ce085ab966d1f3c896a7c8b4f5fc99
|
F src/test_intarray.c d879bbf8e4ce085ab966d1f3c896a7c8b4f5fc99
|
||||||
F src/test_intarray.h 489edb9068bb926583445cb02589344961054207
|
F src/test_intarray.h 489edb9068bb926583445cb02589344961054207
|
||||||
F src/test_journal.c 785edd54f963aefb3c1628124170a56697c68c70
|
F src/test_journal.c 03313c693cca72959dcaaf79f8d76f21c01e19ff
|
||||||
F src/test_loadext.c df586c27176e3c2cb2e099c78da67bf14379a56e
|
F src/test_loadext.c df586c27176e3c2cb2e099c78da67bf14379a56e
|
||||||
F src/test_malloc.c 7ca7be34e0e09ef0ed6619544552ed95732e41f6
|
F src/test_malloc.c 7ca7be34e0e09ef0ed6619544552ed95732e41f6
|
||||||
F src/test_multiplex.c 8e67617b80b532315293761970589581745a52a0
|
F src/test_multiplex.c a7457a1ac46964b7f897d75ecfd447410ec067e6
|
||||||
F src/test_multiplex.h e99c571bc4968b7a9363b661481f3934bfead61d
|
F src/test_multiplex.h e99c571bc4968b7a9363b661481f3934bfead61d
|
||||||
F src/test_mutex.c a6bd7b9cf6e19d989e31392b06ac8d189f0d573e
|
F src/test_mutex.c a6bd7b9cf6e19d989e31392b06ac8d189f0d573e
|
||||||
F src/test_onefile.c 40cf9e212a377a6511469384a64b01e6e34b2eec
|
F src/test_onefile.c 40cf9e212a377a6511469384a64b01e6e34b2eec
|
||||||
@@ -236,8 +236,8 @@ F src/test_superlock.c 2b97936ca127d13962c3605dbc9a4ef269c424cd
|
|||||||
F src/test_syscall.c 162c4ec0137a549c009bb9ecab550527743cfc5d
|
F src/test_syscall.c 162c4ec0137a549c009bb9ecab550527743cfc5d
|
||||||
F src/test_tclvar.c f4dc67d5f780707210d6bb0eb6016a431c04c7fa
|
F src/test_tclvar.c f4dc67d5f780707210d6bb0eb6016a431c04c7fa
|
||||||
F src/test_thread.c 361ae0a0f1cbf5a28ad0388a258b104017a370c0
|
F src/test_thread.c 361ae0a0f1cbf5a28ad0388a258b104017a370c0
|
||||||
F src/test_vfs.c 0ac5b2e3da61bc385c1017890687c359746be2fd
|
F src/test_vfs.c e7855568dfa1e0ba73668d273b65605d9f8b77e8
|
||||||
F src/test_vfstrace.c 2265c9895f350c8d3c39b079998fbe7481505cc1
|
F src/test_vfstrace.c 0b884e06094a746da729119a2cabdc7aa790063d
|
||||||
F src/test_wholenumber.c 6129adfbe7c7444f2e60cc785927f3aa74e12290
|
F src/test_wholenumber.c 6129adfbe7c7444f2e60cc785927f3aa74e12290
|
||||||
F src/test_wsd.c 41cadfd9d97fe8e3e4e44f61a4a8ccd6f7ca8fe9
|
F src/test_wsd.c 41cadfd9d97fe8e3e4e44f61a4a8ccd6f7ca8fe9
|
||||||
F src/tokenize.c 604607d6813e9551cf5189d899e0a25c12681080
|
F src/tokenize.c 604607d6813e9551cf5189d899e0a25c12681080
|
||||||
@@ -246,16 +246,16 @@ F src/update.c f66b651c15e42875f36501ec39a968e836ee5586
|
|||||||
F src/utf.c d83650c3ea08f7407bd9d0839d9885241c209c60
|
F src/utf.c d83650c3ea08f7407bd9d0839d9885241c209c60
|
||||||
F src/util.c 0f33bbbdfcc4a2d8cf20c3b2a16ffc3b57c58a70
|
F src/util.c 0f33bbbdfcc4a2d8cf20c3b2a16ffc3b57c58a70
|
||||||
F src/vacuum.c 05513dca036a1e7848fe18d5ed1265ac0b32365e
|
F src/vacuum.c 05513dca036a1e7848fe18d5ed1265ac0b32365e
|
||||||
F src/vdbe.c af2e9d0ffd3e111140bc51769f6995834be69e11
|
F src/vdbe.c 619fb3fc054f7f9bf41c0e354702dfc35eebb17f
|
||||||
F src/vdbe.h 44fd57aeed86da0cd31206626c13cdde0e72cc0e
|
F src/vdbe.h 44fd57aeed86da0cd31206626c13cdde0e72cc0e
|
||||||
F src/vdbeInt.h b95de01246c15499c700ae00cfda0de25c01358a
|
F src/vdbeInt.h b95de01246c15499c700ae00cfda0de25c01358a
|
||||||
F src/vdbeapi.c 8051038f7674c708f4515ab189fc3ea929e09a4c
|
F src/vdbeapi.c 8051038f7674c708f4515ab189fc3ea929e09a4c
|
||||||
F src/vdbeaux.c be135f46ee48b5726fb59ca41224475c1dbe8f8b
|
F src/vdbeaux.c 8c5a643ba7d0d9882902ef2b4ab3dc2084d838ae
|
||||||
F src/vdbeblob.c c3ccb7c8732858c680f442932e66ad06bb036562
|
F src/vdbeblob.c c3ccb7c8732858c680f442932e66ad06bb036562
|
||||||
F src/vdbemem.c 0498796b6ffbe45e32960d6a1f5adfb6e419883b
|
F src/vdbemem.c 0498796b6ffbe45e32960d6a1f5adfb6e419883b
|
||||||
F src/vdbetrace.c 5d0dc3d5fd54878cc8d6d28eb41deb8d5885b114
|
F src/vdbetrace.c 5d0dc3d5fd54878cc8d6d28eb41deb8d5885b114
|
||||||
F src/vtab.c 48dcef8bc757c2e7b488f68b5ddebb1650da2450
|
F src/vtab.c 9ba8c7fdb7d39260c033a402f6032d3e7bc5d336
|
||||||
F src/wal.c de27c34c8016c00be348fc6bed588816557ceb66
|
F src/wal.c ab1d8c5abf904fd6396f90499cbd8c54b8d6961b
|
||||||
F src/wal.h 66b40bd91bc29a5be1c88ddd1f5ade8f3f48728a
|
F src/wal.h 66b40bd91bc29a5be1c88ddd1f5ade8f3f48728a
|
||||||
F src/walker.c 3112bb3afe1d85dc52317cb1d752055e9a781f8f
|
F src/walker.c 3112bb3afe1d85dc52317cb1d752055e9a781f8f
|
||||||
F src/where.c 55403ce19c506be6a321c7f129aff693d6103db5
|
F src/where.c 55403ce19c506be6a321c7f129aff693d6103db5
|
||||||
@@ -716,7 +716,7 @@ F test/threadtest2.c ace893054fa134af3fc8d6e7cfecddb8e3acefb9
|
|||||||
F test/threadtest3.c 0ed13e09690f6204d7455fac3b0e8ece490f6eef
|
F test/threadtest3.c 0ed13e09690f6204d7455fac3b0e8ece490f6eef
|
||||||
F test/tkt-02a8e81d44.test 58494de77be2cf249228ada3f313fa399821c6ab
|
F test/tkt-02a8e81d44.test 58494de77be2cf249228ada3f313fa399821c6ab
|
||||||
F test/tkt-26ff0c2d1e.test 888324e751512972c6e0d1a09df740d8f5aaf660
|
F test/tkt-26ff0c2d1e.test 888324e751512972c6e0d1a09df740d8f5aaf660
|
||||||
F test/tkt-2d1a5c67d.test 39d2368072315923021700a216379fcf23ac3a5c
|
F test/tkt-2d1a5c67d.test 73574c758502bf23260c17f97fcd9316dfb5a060
|
||||||
F test/tkt-2ea2425d34.test 1cf13e6f75d149b3209a0cb32927a82d3d79fb28
|
F test/tkt-2ea2425d34.test 1cf13e6f75d149b3209a0cb32927a82d3d79fb28
|
||||||
F test/tkt-31338dca7e.test 5741cd48de500347a437ba1be58c8335e83c5a5e
|
F test/tkt-31338dca7e.test 5741cd48de500347a437ba1be58c8335e83c5a5e
|
||||||
F test/tkt-313723c356.test c47f8a9330523e6f35698bf4489bcb29609b53ac
|
F test/tkt-313723c356.test c47f8a9330523e6f35698bf4489bcb29609b53ac
|
||||||
@@ -854,7 +854,7 @@ F test/unique.test 083c7fff74695bcc27a71d75699deba3595bc9c2
|
|||||||
F test/unixexcl.test 9d80a54d86d2261f660758928959368ffc36151e
|
F test/unixexcl.test 9d80a54d86d2261f660758928959368ffc36151e
|
||||||
F test/unordered.test e81169ce2a8f31b2c6b66af691887e1376ab3ced
|
F test/unordered.test e81169ce2a8f31b2c6b66af691887e1376ab3ced
|
||||||
F test/update.test 8bc86fd7ef1a00014f76dc6a6a7c974df4aef172
|
F test/update.test 8bc86fd7ef1a00014f76dc6a6a7c974df4aef172
|
||||||
F test/uri.test 2d08a6f77bf93ca925743a65802c4aa23aaaf373
|
F test/uri.test 53de9a2549cbda9c343223236918ef502f6a9051
|
||||||
F test/utf16align.test 54cd35a27c005a9b6e7815d887718780b6a462ae
|
F test/utf16align.test 54cd35a27c005a9b6e7815d887718780b6a462ae
|
||||||
F test/vacuum.test 29b60e8cc9e573b39676df6c4a75fe9e02d04a09
|
F test/vacuum.test 29b60e8cc9e573b39676df6c4a75fe9e02d04a09
|
||||||
F test/vacuum2.test 91a84c9b08adfc4472097d2e8deb0150214e0e76
|
F test/vacuum2.test 91a84c9b08adfc4472097d2e8deb0150214e0e76
|
||||||
@@ -949,7 +949,7 @@ F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
|
|||||||
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
|
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
|
||||||
F tool/split-sqlite3c.tcl d9be87f1c340285a3e081eb19b4a247981ed290c
|
F tool/split-sqlite3c.tcl d9be87f1c340285a3e081eb19b4a247981ed290c
|
||||||
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
|
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
|
||||||
P 6883580e6c8973010a42d1d2c5bde04c6b2f4eb7 67bf1c9a888b0d84d252d6c4c754c2c51994d208
|
P 5b1b536cf828850d0e8ac2ab08e8696082715877 edb865c35415f9553f8279028120f7b8de2bf7e2
|
||||||
R f15f9213bb9ad0f88efa9254eb2387a3
|
R 15c7d86baba462087df3e66721c44f54
|
||||||
U drh
|
U drh
|
||||||
Z 1a1886a9d9151866e45101a5d0e49b24
|
Z 3723c6e367168438b5fa877d64e1595b
|
||||||
|
@@ -1 +1 @@
|
|||||||
5b1b536cf828850d0e8ac2ab08e8696082715877
|
832886b1e6edb916d9824924c7d88202f4eb1969
|
@@ -5755,8 +5755,8 @@ int sqlite3PagerCommitPhaseOne(
|
|||||||
pList = pPageOne;
|
pList = pPageOne;
|
||||||
pList->pDirty = 0;
|
pList->pDirty = 0;
|
||||||
}
|
}
|
||||||
assert( pList!=0 || rc!=SQLITE_OK );
|
assert( rc==SQLITE_OK );
|
||||||
if( pList ){
|
if( ALWAYS(pList) ){
|
||||||
rc = pagerWalFrames(pPager, pList, pPager->dbSize, 1,
|
rc = pagerWalFrames(pPager, pList, pPager->dbSize, 1,
|
||||||
(pPager->fullSync ? pPager->syncFlags : 0)
|
(pPager->fullSync ? pPager->syncFlags : 0)
|
||||||
);
|
);
|
||||||
|
@@ -253,6 +253,13 @@ int sqlite3PcacheFetch(
|
|||||||
}
|
}
|
||||||
if( pPg ){
|
if( pPg ){
|
||||||
int rc;
|
int rc;
|
||||||
|
#ifdef SQLITE_LOG_CACHE_SPILL
|
||||||
|
sqlite3_log(SQLITE_FULL,
|
||||||
|
"spill page %d making room for %d - cache used: %d/%d",
|
||||||
|
pPg->pgno, pgno,
|
||||||
|
sqlite3GlobalConfig.pcache.xPagecount(pCache->pCache),
|
||||||
|
pCache->nMax);
|
||||||
|
#endif
|
||||||
rc = pCache->xStress(pCache->pStress, pPg);
|
rc = pCache->xStress(pCache->pStress, pPg);
|
||||||
if( rc!=SQLITE_OK && rc!=SQLITE_BUSY ){
|
if( rc!=SQLITE_OK && rc!=SQLITE_BUSY ){
|
||||||
return rc;
|
return rc;
|
||||||
|
@@ -759,11 +759,11 @@ typedef struct sqlite3_mutex sqlite3_mutex;
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
** CAPI3REF: OS Interface Object
|
** CAPI3REF: OS Interface Object
|
||||||
** KEYWORDS: VFS VFSes
|
|
||||||
**
|
**
|
||||||
** An instance of the sqlite3_vfs object defines the interface between
|
** An instance of the sqlite3_vfs object defines the interface between
|
||||||
** the SQLite core and the underlying operating system. The "vfs"
|
** the SQLite core and the underlying operating system. The "vfs"
|
||||||
** in the name of the object stands for "virtual file system".
|
** in the name of the object stands for "virtual file system". See
|
||||||
|
** the [VFS | VFS documentation] for further information.
|
||||||
**
|
**
|
||||||
** The value of the iVersion field is initially 1 but may be larger in
|
** The value of the iVersion field is initially 1 but may be larger in
|
||||||
** future versions of SQLite. Additional fields may be appended to this
|
** future versions of SQLite. Additional fields may be appended to this
|
||||||
|
@@ -1243,6 +1243,7 @@ struct VTable {
|
|||||||
sqlite3_vtab *pVtab; /* Pointer to vtab instance */
|
sqlite3_vtab *pVtab; /* Pointer to vtab instance */
|
||||||
int nRef; /* Number of pointers to this structure */
|
int nRef; /* Number of pointers to this structure */
|
||||||
u8 bConstraint; /* True if constraints are supported */
|
u8 bConstraint; /* True if constraints are supported */
|
||||||
|
int iSavepoint; /* Depth of the SAVEPOINT stack */
|
||||||
VTable *pNext; /* Next in linked list (see above) */
|
VTable *pNext; /* Next in linked list (see above) */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -10,14 +10,12 @@
|
|||||||
**
|
**
|
||||||
*************************************************************************
|
*************************************************************************
|
||||||
**
|
**
|
||||||
** An example of a simple VFS implementation that omits complex features
|
** This file implements an example of a simple VFS implementation that
|
||||||
** often not required or not possible on embedded platforms. Also includes
|
** omits complex features often not required or not possible on embedded
|
||||||
** code to buffer writes to the journal file, which can be a significant
|
** platforms. Code is included to buffer writes to the journal file,
|
||||||
** performance improvement on some embedded platforms.
|
** which can be a significant performance improvement on some embedded
|
||||||
|
** platforms.
|
||||||
**
|
**
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
** OVERVIEW
|
** OVERVIEW
|
||||||
**
|
**
|
||||||
** The code in this file implements a minimal SQLite VFS that can be
|
** The code in this file implements a minimal SQLite VFS that can be
|
||||||
|
@@ -14,13 +14,7 @@
|
|||||||
** an existing VFS. The code in this file attempts to verify that SQLite
|
** an existing VFS. The code in this file attempts to verify that SQLite
|
||||||
** correctly populates and syncs a journal file before writing to a
|
** correctly populates and syncs a journal file before writing to a
|
||||||
** corresponding database file.
|
** corresponding database file.
|
||||||
*/
|
**
|
||||||
#if SQLITE_TEST /* This file is used for testing only */
|
|
||||||
|
|
||||||
#include "sqlite3.h"
|
|
||||||
#include "sqliteInt.h"
|
|
||||||
|
|
||||||
/*
|
|
||||||
** INTERFACE
|
** INTERFACE
|
||||||
**
|
**
|
||||||
** The public interface to this wrapper VFS is two functions:
|
** The public interface to this wrapper VFS is two functions:
|
||||||
@@ -99,6 +93,10 @@
|
|||||||
**
|
**
|
||||||
** c) The journal file is deleted using xDelete.
|
** c) The journal file is deleted using xDelete.
|
||||||
*/
|
*/
|
||||||
|
#if SQLITE_TEST /* This file is used for testing only */
|
||||||
|
|
||||||
|
#include "sqlite3.h"
|
||||||
|
#include "sqliteInt.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Maximum pathname length supported by the jt backend.
|
** Maximum pathname length supported by the jt backend.
|
||||||
|
@@ -11,13 +11,36 @@
|
|||||||
*************************************************************************
|
*************************************************************************
|
||||||
**
|
**
|
||||||
** This file contains a VFS "shim" - a layer that sits in between the
|
** This file contains a VFS "shim" - a layer that sits in between the
|
||||||
** pager and the real VFS.
|
** pager and the real VFS - that breaks up a very large database file
|
||||||
|
** into two or more smaller files on disk. This is useful, for example,
|
||||||
|
** in order to support large, multi-gigabyte databases on older filesystems
|
||||||
|
** that limit the maximum file size to 2 GiB.
|
||||||
**
|
**
|
||||||
** This particular shim enforces a multiplex system on DB files.
|
** USAGE:
|
||||||
** This shim shards/partitions a single DB file into smaller
|
|
||||||
** "chunks" such that the total DB file size may exceed the maximum
|
|
||||||
** file size of the underlying file system.
|
|
||||||
**
|
**
|
||||||
|
** Compile this source file and link it with your application. Then
|
||||||
|
** at start-time, invoke the following procedure:
|
||||||
|
**
|
||||||
|
** int sqlite3_multiplex_initialize(
|
||||||
|
** const char *zOrigVfsName, // The underlying real VFS
|
||||||
|
** int makeDefault // True to make multiplex the default VFS
|
||||||
|
** );
|
||||||
|
**
|
||||||
|
** The procedure call above will create and register a new VFS shim named
|
||||||
|
** "multiplex". The multiplex VFS will use the VFS named by zOrigVfsName to
|
||||||
|
** do the actual disk I/O. (The zOrigVfsName parameter may be NULL, in
|
||||||
|
** which case the default VFS at the moment sqlite3_multiplex_initialize()
|
||||||
|
** is called will be used as the underlying real VFS.)
|
||||||
|
**
|
||||||
|
** If the makeDefault parameter is TRUE then multiplex becomes the new
|
||||||
|
** default VFS. Otherwise, you can use the multiplex VFS by specifying
|
||||||
|
** "multiplex" as the 4th parameter to sqlite3_open_v2() or by employing
|
||||||
|
** URI filenames and adding "vfs=multiplex" as a parameter to the filename
|
||||||
|
** URI.
|
||||||
|
**
|
||||||
|
** The multiplex VFS allows databases up to 32 GiB in size. But it splits
|
||||||
|
** the files up into 1 GiB pieces, so that they will work even on filesystems
|
||||||
|
** that do not support large files.
|
||||||
*/
|
*/
|
||||||
#include "sqlite3.h"
|
#include "sqlite3.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@@ -10,10 +10,6 @@
|
|||||||
**
|
**
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
**
|
**
|
||||||
*/
|
|
||||||
#if SQLITE_TEST /* This file is used for testing only */
|
|
||||||
|
|
||||||
/*
|
|
||||||
** This file contains the implementation of the Tcl [testvfs] command,
|
** This file contains the implementation of the Tcl [testvfs] command,
|
||||||
** used to create SQLite VFS implementations with various properties and
|
** used to create SQLite VFS implementations with various properties and
|
||||||
** instrumentation to support testing SQLite.
|
** instrumentation to support testing SQLite.
|
||||||
@@ -28,6 +24,7 @@
|
|||||||
** -mxpathname INTEGER (Value for sqlite3_vfs.mxPathname)
|
** -mxpathname INTEGER (Value for sqlite3_vfs.mxPathname)
|
||||||
** -iversion INTEGER (Value for sqlite3_vfs.iVersion)
|
** -iversion INTEGER (Value for sqlite3_vfs.iVersion)
|
||||||
*/
|
*/
|
||||||
|
#if SQLITE_TEST /* This file is used for testing only */
|
||||||
|
|
||||||
#include "sqlite3.h"
|
#include "sqlite3.h"
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
|
@@ -12,6 +12,100 @@
|
|||||||
**
|
**
|
||||||
** This file contains code implements a VFS shim that writes diagnostic
|
** This file contains code implements a VFS shim that writes diagnostic
|
||||||
** output for each VFS call, similar to "strace".
|
** output for each VFS call, similar to "strace".
|
||||||
|
**
|
||||||
|
** USAGE:
|
||||||
|
**
|
||||||
|
** This source file exports a single symbol which is the name of a
|
||||||
|
** function:
|
||||||
|
**
|
||||||
|
** int vfstrace_register(
|
||||||
|
** const char *zTraceName, // Name of the newly constructed VFS
|
||||||
|
** const char *zOldVfsName, // Name of the underlying VFS
|
||||||
|
** int (*xOut)(const char*,void*), // Output routine. ex: fputs
|
||||||
|
** void *pOutArg, // 2nd argument to xOut. ex: stderr
|
||||||
|
** int makeDefault // Make the new VFS the default
|
||||||
|
** );
|
||||||
|
**
|
||||||
|
** Applications that want to trace their VFS usage must provide a callback
|
||||||
|
** function with this prototype:
|
||||||
|
**
|
||||||
|
** int traceOutput(const char *zMessage, void *pAppData);
|
||||||
|
**
|
||||||
|
** This function will "output" the trace messages, where "output" can
|
||||||
|
** mean different things to different applications. The traceOutput function
|
||||||
|
** for the command-line shell (see shell.c) is "fputs" from the standard
|
||||||
|
** library, which means that all trace output is written on the stream
|
||||||
|
** specified by the second argument. In the case of the command-line shell
|
||||||
|
** the second argument is stderr. Other applications might choose to output
|
||||||
|
** trace information to a file, over a socket, or write it into a buffer.
|
||||||
|
**
|
||||||
|
** The vfstrace_register() function creates a new "shim" VFS named by
|
||||||
|
** the zTraceName parameter. A "shim" VFS is an SQLite backend that does
|
||||||
|
** not really perform the duties of a true backend, but simply filters or
|
||||||
|
** interprets VFS calls before passing them off to another VFS which does
|
||||||
|
** the actual work. In this case the other VFS - the one that does the
|
||||||
|
** real work - is identified by the second parameter, zOldVfsName. If
|
||||||
|
** the the 2nd parameter is NULL then the default VFS is used. The common
|
||||||
|
** case is for the 2nd parameter to be NULL.
|
||||||
|
**
|
||||||
|
** The third and fourth parameters are the pointer to the output function
|
||||||
|
** and the second argument to the output function. For the SQLite
|
||||||
|
** command-line shell, when the -vfstrace option is used, these parameters
|
||||||
|
** are fputs and stderr, respectively.
|
||||||
|
**
|
||||||
|
** The fifth argument is true (non-zero) to cause the newly created VFS
|
||||||
|
** to become the default VFS. The common case is for the fifth parameter
|
||||||
|
** to be true.
|
||||||
|
**
|
||||||
|
** The call to vfstrace_register() simply creates the shim VFS that does
|
||||||
|
** tracing. The application must also arrange to use the new VFS for
|
||||||
|
** all database connections that are created and for which tracing is
|
||||||
|
** desired. This can be done by specifying the trace VFS using URI filename
|
||||||
|
** notation, or by specifying the trace VFS as the 4th parameter to
|
||||||
|
** sqlite3_open_v2() or by making the trace VFS be the default (by setting
|
||||||
|
** the 5th parameter of vfstrace_register() to 1).
|
||||||
|
**
|
||||||
|
**
|
||||||
|
** ENABLING VFSTRACE IN A COMMAND-LINE SHELL
|
||||||
|
**
|
||||||
|
** The SQLite command line shell implemented by the shell.c source file
|
||||||
|
** can be used with this module. To compile in -vfstrace support, first
|
||||||
|
** gather this file (test_vfstrace.c), the shell source file (shell.c),
|
||||||
|
** and the SQLite amalgamation source files (sqlite3.c, sqlite3.h) into
|
||||||
|
** the working directory. Then compile using a command like the following:
|
||||||
|
**
|
||||||
|
** gcc -o sqlite3 -Os -I. -DSQLITE_ENABLE_VFSTRACE \
|
||||||
|
** -DSQLITE_THREADSAFE=0 -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_RTREE \
|
||||||
|
** -DHAVE_READLINE -DHAVE_USLEEP=1 \
|
||||||
|
** shell.c test_vfstrace.c sqlite3.c -ldl -lreadline -lncurses
|
||||||
|
**
|
||||||
|
** The gcc command above works on Linux and provides (in addition to the
|
||||||
|
** -vfstrace option) support for FTS3 and FTS4, RTREE, and command-line
|
||||||
|
** editing using the readline library. The command-line shell does not
|
||||||
|
** use threads so we added -DSQLITE_THREADSAFE=0 just to make the code
|
||||||
|
** run a little faster. For compiling on a Mac, you'll probably need
|
||||||
|
** to omit the -DHAVE_READLINE, the -lreadline, and the -lncurses options.
|
||||||
|
** The compilation could be simplified to just this:
|
||||||
|
**
|
||||||
|
** gcc -DSQLITE_ENABLE_VFSTRACE \
|
||||||
|
** shell.c test_vfstrace.c sqlite3.c -ldl -lpthread
|
||||||
|
**
|
||||||
|
** In this second example, all unnecessary options have been removed
|
||||||
|
** Note that since the code is now threadsafe, we had to add the -lpthread
|
||||||
|
** option to pull in the pthreads library.
|
||||||
|
**
|
||||||
|
** To cross-compile for windows using MinGW, a command like this might
|
||||||
|
** work:
|
||||||
|
**
|
||||||
|
** /opt/mingw/bin/i386-mingw32msvc-gcc -o sqlite3.exe -Os -I \
|
||||||
|
** -DSQLITE_THREADSAFE=0 -DSQLITE_ENABLE_VFSTRACE \
|
||||||
|
** shell.c test_vfstrace.c sqlite3.c
|
||||||
|
**
|
||||||
|
** Similar compiler commands will work on different systems. The key
|
||||||
|
** invariants are (1) you must have -DSQLITE_ENABLE_VFSTRACE so that
|
||||||
|
** the shell.c source file will know to include the -vfstrace command-line
|
||||||
|
** option and (2) you must compile and link the three source files
|
||||||
|
** shell,c, test_vfstrace.c, and sqlite3.c.
|
||||||
*/
|
*/
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@@ -2594,13 +2594,16 @@ case OP_Savepoint: {
|
|||||||
}else{
|
}else{
|
||||||
nName = sqlite3Strlen30(zName);
|
nName = sqlite3Strlen30(zName);
|
||||||
|
|
||||||
|
#ifndef SQLITE_OMIT_VIRTUAL_TABLE
|
||||||
/* This call is Ok even if this savepoint is actually a transaction
|
/* This call is Ok even if this savepoint is actually a transaction
|
||||||
** savepoint (and therefore should not prompt xSavepoint()) callbacks.
|
** savepoint (and therefore should not prompt xSavepoint()) callbacks.
|
||||||
** If this is a transaction savepoint being opened, it is guaranteed
|
** If this is a transaction savepoint being opened, it is guaranteed
|
||||||
** that the db->aVTrans[] array is empty. */
|
** that the db->aVTrans[] array is empty. */
|
||||||
assert( db->autoCommit==0 || db->nVTrans==0 );
|
assert( db->autoCommit==0 || db->nVTrans==0 );
|
||||||
rc = sqlite3VtabSavepoint(db, SAVEPOINT_BEGIN, p->iStatement);
|
rc = sqlite3VtabSavepoint(db, SAVEPOINT_BEGIN,
|
||||||
|
db->nStatement+db->nSavepoint);
|
||||||
if( rc!=SQLITE_OK ) goto abort_due_to_error;
|
if( rc!=SQLITE_OK ) goto abort_due_to_error;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Create a new savepoint structure. */
|
/* Create a new savepoint structure. */
|
||||||
pNew = sqlite3DbMallocRaw(db, sizeof(Savepoint)+nName+1);
|
pNew = sqlite3DbMallocRaw(db, sizeof(Savepoint)+nName+1);
|
||||||
@@ -2849,7 +2852,7 @@ case OP_Transaction: {
|
|||||||
p->iStatement = db->nSavepoint + db->nStatement;
|
p->iStatement = db->nSavepoint + db->nStatement;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = sqlite3VtabSavepoint(db, SAVEPOINT_BEGIN, p->iStatement);
|
rc = sqlite3VtabSavepoint(db, SAVEPOINT_BEGIN, p->iStatement-1);
|
||||||
if( rc==SQLITE_OK ){
|
if( rc==SQLITE_OK ){
|
||||||
rc = sqlite3BtreeBeginStmt(pBt, p->iStatement);
|
rc = sqlite3BtreeBeginStmt(pBt, p->iStatement);
|
||||||
}
|
}
|
||||||
|
@@ -2203,17 +2203,11 @@ int sqlite3VdbeHalt(Vdbe *p){
|
|||||||
** do so. If this operation returns an error, and the current statement
|
** do so. If this operation returns an error, and the current statement
|
||||||
** error code is SQLITE_OK or SQLITE_CONSTRAINT, then promote the
|
** error code is SQLITE_OK or SQLITE_CONSTRAINT, then promote the
|
||||||
** current statement error code.
|
** current statement error code.
|
||||||
**
|
|
||||||
** Note that sqlite3VdbeCloseStatement() can only fail if eStatementOp
|
|
||||||
** is SAVEPOINT_ROLLBACK. But if p->rc==SQLITE_OK then eStatementOp
|
|
||||||
** must be SAVEPOINT_RELEASE. Hence the NEVER(p->rc==SQLITE_OK) in
|
|
||||||
** the following code.
|
|
||||||
*/
|
*/
|
||||||
if( eStatementOp ){
|
if( eStatementOp ){
|
||||||
rc = sqlite3VdbeCloseStatement(p, eStatementOp);
|
rc = sqlite3VdbeCloseStatement(p, eStatementOp);
|
||||||
if( rc ){
|
if( rc ){
|
||||||
assert( eStatementOp==SAVEPOINT_ROLLBACK );
|
if( p->rc==SQLITE_OK || p->rc==SQLITE_CONSTRAINT ){
|
||||||
if( NEVER(p->rc==SQLITE_OK) || p->rc==SQLITE_CONSTRAINT ){
|
|
||||||
p->rc = rc;
|
p->rc = rc;
|
||||||
sqlite3DbFree(db, p->zErrMsg);
|
sqlite3DbFree(db, p->zErrMsg);
|
||||||
p->zErrMsg = 0;
|
p->zErrMsg = 0;
|
||||||
|
40
src/vtab.c
40
src/vtab.c
@@ -577,11 +577,11 @@ int sqlite3VtabCallConnect(Parse *pParse, Table *pTab){
|
|||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Add the virtual table pVTab to the array sqlite3.aVTrans[].
|
** Grow the db->aVTrans[] array so that there is room for at least one
|
||||||
|
** more v-table. Return SQLITE_NOMEM if a malloc fails, or SQLITE_OK otherwise.
|
||||||
*/
|
*/
|
||||||
static int addToVTrans(sqlite3 *db, VTable *pVTab){
|
static int growVTrans(sqlite3 *db){
|
||||||
const int ARRAY_INCR = 5;
|
const int ARRAY_INCR = 5;
|
||||||
|
|
||||||
/* Grow the sqlite3.aVTrans array if required */
|
/* Grow the sqlite3.aVTrans array if required */
|
||||||
@@ -596,10 +596,17 @@ static int addToVTrans(sqlite3 *db, VTable *pVTab){
|
|||||||
db->aVTrans = aVTrans;
|
db->aVTrans = aVTrans;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return SQLITE_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Add the virtual table pVTab to the array sqlite3.aVTrans[]. Space should
|
||||||
|
** have already been reserved using growVTrans().
|
||||||
|
*/
|
||||||
|
static void addToVTrans(sqlite3 *db, VTable *pVTab){
|
||||||
/* Add pVtab to the end of sqlite3.aVTrans */
|
/* Add pVtab to the end of sqlite3.aVTrans */
|
||||||
db->aVTrans[db->nVTrans++] = pVTab;
|
db->aVTrans[db->nVTrans++] = pVTab;
|
||||||
sqlite3VtabLock(pVTab);
|
sqlite3VtabLock(pVTab);
|
||||||
return SQLITE_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -637,7 +644,10 @@ int sqlite3VtabCallCreate(sqlite3 *db, int iDb, const char *zTab, char **pzErr){
|
|||||||
/* Justification of ALWAYS(): The xConstructor method is required to
|
/* Justification of ALWAYS(): The xConstructor method is required to
|
||||||
** create a valid sqlite3_vtab if it returns SQLITE_OK. */
|
** create a valid sqlite3_vtab if it returns SQLITE_OK. */
|
||||||
if( rc==SQLITE_OK && ALWAYS(sqlite3GetVTable(db, pTab)) ){
|
if( rc==SQLITE_OK && ALWAYS(sqlite3GetVTable(db, pTab)) ){
|
||||||
rc = addToVTrans(db, sqlite3GetVTable(db, pTab));
|
rc = growVTrans(db);
|
||||||
|
if( rc==SQLITE_OK ){
|
||||||
|
addToVTrans(db, sqlite3GetVTable(db, pTab));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
@@ -753,6 +763,7 @@ static void callFinaliser(sqlite3 *db, int offset){
|
|||||||
x = *(int (**)(sqlite3_vtab *))((char *)p->pModule + offset);
|
x = *(int (**)(sqlite3_vtab *))((char *)p->pModule + offset);
|
||||||
if( x ) x(p);
|
if( x ) x(p);
|
||||||
}
|
}
|
||||||
|
pVTab->iSavepoint = 0;
|
||||||
sqlite3VtabUnlock(pVTab);
|
sqlite3VtabUnlock(pVTab);
|
||||||
}
|
}
|
||||||
sqlite3DbFree(db, db->aVTrans);
|
sqlite3DbFree(db, db->aVTrans);
|
||||||
@@ -842,10 +853,14 @@ int sqlite3VtabBegin(sqlite3 *db, VTable *pVTab){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Invoke the xBegin method */
|
/* Invoke the xBegin method. If successful, add the vtab to the
|
||||||
rc = pModule->xBegin(pVTab->pVtab);
|
** sqlite3.aVTrans[] array. */
|
||||||
|
rc = growVTrans(db);
|
||||||
if( rc==SQLITE_OK ){
|
if( rc==SQLITE_OK ){
|
||||||
rc = addToVTrans(db, pVTab);
|
rc = pModule->xBegin(pVTab->pVtab);
|
||||||
|
if( rc==SQLITE_OK ){
|
||||||
|
addToVTrans(db, pVTab);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return rc;
|
return rc;
|
||||||
@@ -870,15 +885,18 @@ int sqlite3VtabSavepoint(sqlite3 *db, int op, int iSavepoint){
|
|||||||
int rc = SQLITE_OK;
|
int rc = SQLITE_OK;
|
||||||
|
|
||||||
assert( op==SAVEPOINT_RELEASE||op==SAVEPOINT_ROLLBACK||op==SAVEPOINT_BEGIN );
|
assert( op==SAVEPOINT_RELEASE||op==SAVEPOINT_ROLLBACK||op==SAVEPOINT_BEGIN );
|
||||||
|
assert( iSavepoint>=0 );
|
||||||
if( db->aVTrans ){
|
if( db->aVTrans ){
|
||||||
int i;
|
int i;
|
||||||
for(i=0; rc==SQLITE_OK && i<db->nVTrans; i++){
|
for(i=0; rc==SQLITE_OK && i<db->nVTrans; i++){
|
||||||
const sqlite3_module *pMod = db->aVTrans[i]->pMod->pModule;
|
VTable *pVTab = db->aVTrans[i];
|
||||||
|
const sqlite3_module *pMod = pVTab->pMod->pModule;
|
||||||
if( pMod->iVersion>=2 ){
|
if( pMod->iVersion>=2 ){
|
||||||
int (*xMethod)(sqlite3_vtab *, int);
|
int (*xMethod)(sqlite3_vtab *, int);
|
||||||
switch( op ){
|
switch( op ){
|
||||||
case SAVEPOINT_BEGIN:
|
case SAVEPOINT_BEGIN:
|
||||||
xMethod = pMod->xSavepoint;
|
xMethod = pMod->xSavepoint;
|
||||||
|
pVTab->iSavepoint = iSavepoint+1;
|
||||||
break;
|
break;
|
||||||
case SAVEPOINT_ROLLBACK:
|
case SAVEPOINT_ROLLBACK:
|
||||||
xMethod = pMod->xRollbackTo;
|
xMethod = pMod->xRollbackTo;
|
||||||
@@ -887,7 +905,9 @@ int sqlite3VtabSavepoint(sqlite3 *db, int op, int iSavepoint){
|
|||||||
xMethod = pMod->xRelease;
|
xMethod = pMod->xRelease;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if( xMethod ) rc = xMethod(db->aVTrans[i]->pVtab, iSavepoint);
|
if( xMethod && pVTab->iSavepoint>iSavepoint ){
|
||||||
|
rc = xMethod(db->aVTrans[i]->pVtab, iSavepoint);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -2539,10 +2539,12 @@ static int walRestartLog(Wal *pWal){
|
|||||||
if( pWal->mxWalSize>=0 ){
|
if( pWal->mxWalSize>=0 ){
|
||||||
i64 sz;
|
i64 sz;
|
||||||
int rx;
|
int rx;
|
||||||
|
sqlite3BeginBenignMalloc();
|
||||||
rx = sqlite3OsFileSize(pWal->pWalFd, &sz);
|
rx = sqlite3OsFileSize(pWal->pWalFd, &sz);
|
||||||
if( rx==SQLITE_OK && (sz > pWal->mxWalSize) ){
|
if( rx==SQLITE_OK && (sz > pWal->mxWalSize) ){
|
||||||
rx = sqlite3OsTruncate(pWal->pWalFd, pWal->mxWalSize);
|
rx = sqlite3OsTruncate(pWal->pWalFd, pWal->mxWalSize);
|
||||||
}
|
}
|
||||||
|
sqlite3EndBenignMalloc();
|
||||||
if( rx ){
|
if( rx ){
|
||||||
sqlite3_log(rx, "cannot limit WAL size: %s", pWal->zWalName);
|
sqlite3_log(rx, "cannot limit WAL size: %s", pWal->zWalName);
|
||||||
}
|
}
|
||||||
|
@@ -17,8 +17,9 @@
|
|||||||
|
|
||||||
set testdir [file dirname $argv0]
|
set testdir [file dirname $argv0]
|
||||||
source $testdir/tester.tcl
|
source $testdir/tester.tcl
|
||||||
|
set testprefix tkt-2d1a5c67d
|
||||||
|
|
||||||
ifcapable !wal {finish_test; return}
|
ifcapable {!wal || !vtab} {finish_test; return}
|
||||||
|
|
||||||
for {set ii 1} {$ii<=10} {incr ii} {
|
for {set ii 1} {$ii<=10} {incr ii} {
|
||||||
do_test tkt-2d1a5c67d.1.$ii {
|
do_test tkt-2d1a5c67d.1.$ii {
|
||||||
@@ -70,4 +71,57 @@ for {set ii 1} {$ii<=10} {incr ii} {
|
|||||||
} {1000000 1 2}
|
} {1000000 1 2}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
db close
|
||||||
|
sqlite3 db test.db
|
||||||
|
|
||||||
|
|
||||||
|
do_execsql_test 3.1 {
|
||||||
|
PRAGMA cache_size = 10;
|
||||||
|
CREATE TABLE t3(a INTEGER PRIMARY KEY, b);
|
||||||
|
CREATE TABLE t4(a);
|
||||||
|
}
|
||||||
|
|
||||||
|
do_execsql_test 3.2 {
|
||||||
|
INSERT INTO t3 VALUES(NULL, randomblob(500));
|
||||||
|
INSERT INTO t3 SELECT NULL, b||b FROM t3; -- 2
|
||||||
|
INSERT INTO t3 SELECT NULL, b||b FROM t3; -- 4
|
||||||
|
INSERT INTO t3 SELECT NULL, b||b FROM t3; -- 8
|
||||||
|
INSERT INTO t3 SELECT NULL, b||b FROM t3; -- 16
|
||||||
|
INSERT INTO t3 SELECT NULL, b||b FROM t3; -- 32
|
||||||
|
INSERT INTO t3 SELECT NULL, b||b FROM t3; -- 64
|
||||||
|
INSERT INTO t3 SELECT NULL, b||b FROM t3; -- 128
|
||||||
|
}
|
||||||
|
|
||||||
|
do_execsql_test 3.3 {
|
||||||
|
BEGIN;
|
||||||
|
INSERT INTO t4 VALUES('xyz');
|
||||||
|
}
|
||||||
|
|
||||||
|
do_test 3.4 {
|
||||||
|
set blobs [list]
|
||||||
|
for {set i 1} {$i<100} {incr i} {
|
||||||
|
set b [db incrblob -readonly t3 b $i]
|
||||||
|
read $b
|
||||||
|
lappend blobs $b
|
||||||
|
}
|
||||||
|
|
||||||
|
execsql COMMIT
|
||||||
|
execsql { SELECT * FROM t4 WHERE a = 'xyz' }
|
||||||
|
} {xyz}
|
||||||
|
|
||||||
|
do_test 3.5 {
|
||||||
|
foreach b $blobs { close $b }
|
||||||
|
execsql { SELECT * FROM t4 WHERE a = 'xyz' }
|
||||||
|
} {xyz}
|
||||||
|
|
||||||
|
# Check that recovery works on the WAL file.
|
||||||
|
#
|
||||||
|
forcedelete test.db2-wal test.db2
|
||||||
|
do_test 3.6 {
|
||||||
|
file copy test.db-wal test.db2-wal
|
||||||
|
file copy test.db test.db2
|
||||||
|
sqlite3 db2 test.db2
|
||||||
|
execsql { SELECT * FROM t4 WHERE a = 'xyz' } db2
|
||||||
|
} {xyz}
|
||||||
|
|
||||||
finish_test
|
finish_test
|
||||||
|
@@ -46,7 +46,7 @@ foreach {tn uri file} {
|
|||||||
11 file file
|
11 file file
|
||||||
12 http:test.db http:test.db
|
12 http:test.db http:test.db
|
||||||
13 file:test.db%00extra test.db
|
13 file:test.db%00extra test.db
|
||||||
14 file:test%00.db%00extra test
|
14 file:testdb%00.db%00extra testdb
|
||||||
|
|
||||||
15 test.db?mork=1#boris test.db?mork=1#boris
|
15 test.db?mork=1#boris test.db?mork=1#boris
|
||||||
16 file://localhostPWD/test.db%3Fhello test.db?hello
|
16 file://localhostPWD/test.db%3Fhello test.db?hello
|
||||||
@@ -59,6 +59,7 @@ foreach {tn uri file} {
|
|||||||
set uri [string map [list PWD [pwd]] $uri]
|
set uri [string map [list PWD [pwd]] $uri]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if {[file isdir $file]} {error "$file is a directory"}
|
||||||
forcedelete $file
|
forcedelete $file
|
||||||
do_test 1.$tn.1 { file exists $file } 0
|
do_test 1.$tn.1 { file exists $file } 0
|
||||||
set DB [sqlite3_open $uri]
|
set DB [sqlite3_open $uri]
|
||||||
@@ -90,9 +91,9 @@ foreach {tn uri kvlist} {
|
|||||||
3 file:test.db?hello=1&world=2&vfs=tvfs {hello 1 world 2 vfs tvfs}
|
3 file:test.db?hello=1&world=2&vfs=tvfs {hello 1 world 2 vfs tvfs}
|
||||||
4 file:test.db?hello=1&world=2&vfs=tvfs2 {}
|
4 file:test.db?hello=1&world=2&vfs=tvfs2 {}
|
||||||
5 file:test.db?%68%65%6C%6C%6F=%77%6F%72%6C%64 {hello world}
|
5 file:test.db?%68%65%6C%6C%6F=%77%6F%72%6C%64 {hello world}
|
||||||
6 file:test%00.db?hello%00extra=world%00ex {hello world}
|
6 file:testdb%00.db?hello%00extra=world%00ex {hello world}
|
||||||
7 file:test%00.db?hello%00=world%00 {hello world}
|
7 file:testdb%00.db?hello%00=world%00 {hello world}
|
||||||
8 file:test%00.db?=world&xyz=abc {xyz abc}
|
8 file:testdb%00.db?=world&xyz=abc {xyz abc}
|
||||||
9 file:test.db?%00hello=world&xyz=abc {xyz abc}
|
9 file:test.db?%00hello=world&xyz=abc {xyz abc}
|
||||||
10 file:test.db?hello=%00world&xyz= {hello {} xyz {}}
|
10 file:test.db?hello=%00world&xyz= {hello {} xyz {}}
|
||||||
11 file:test.db?=#ravada {}
|
11 file:test.db?=#ravada {}
|
||||||
|
Reference in New Issue
Block a user