Add the "PRAGMA reset_database=ON|OFF" command. When on, it causes the
database to appear to be empty, causing the next transaction to reset it to an empty database. FossilOrigin-Name: 02e1a13c1f04bb72599b98f51240c78d0d050de264fef5808fd97db3f4c16dac
This commit is contained in:
parent
03db962ab5
commit
0314cf3aa5
25
manifest
25
manifest
@ -1,5 +1,5 @@
|
||||
C Update\stest\sscript\sfts3expr4.test\sso\sthat\sit\salways\screates\sfts3\stokenizers\sin\nthe\s"en_US"\slocality.
|
||||
D 2018-04-27T18:05:01.487
|
||||
C Add\sthe\s"PRAGMA\sreset_database=ON|OFF"\scommand.\s\sWhen\son,\sit\scauses\sthe\ndatabase\sto\sappear\sto\sbe\sempty,\scausing\sthe\snext\stransaction\sto\sreset\sit\sto\nan\sempty\sdatabase.
|
||||
D 2018-04-28T01:27:09.774
|
||||
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
||||
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
||||
F Makefile.in 5ce9343cba9c189046f1afe6d2bcc1f68079439febc05267b98aec6ecc752439
|
||||
@ -433,7 +433,7 @@ F src/auth.c 6277d63837357549fe14e723490d6dc1a38768d71c795c5eb5c0f8a99f918f73
|
||||
F src/backup.c faf17e60b43233c214aae6a8179d24503a61e83b
|
||||
F src/bitvec.c 17ea48eff8ba979f1f5b04cc484c7bb2be632f33
|
||||
F src/btmutex.c 8acc2f464ee76324bf13310df5692a262b801808984c1b79defb2503bbafadb6
|
||||
F src/btree.c 9eb9531c65346bbfccf5325384b7db1849daf4db6601dcfe21ba5c5b20623b64
|
||||
F src/btree.c fa7da0a5584e5182b92536bc4b7622a154a468997a075d5901345efb79a05ffe
|
||||
F src/btree.h 0866c0a08255142ea0e754aabd211c843cab32045c978a592a43152405ed0c84
|
||||
F src/btreeInt.h 620ab4c7235f43572cf3ac2ac8723cbdf68073be4d29da24897c7b77dda5fd96
|
||||
F src/build.c c4227d058d52c24ffce2d33cd3a11234d8e8603901243cdb5165eddf64ee2177
|
||||
@ -486,8 +486,8 @@ F src/pcache.c 135ef0bc6fb2e3b7178d49ab5c9176254c8a691832c1bceb1156b2fbdd0869bd
|
||||
F src/pcache.h 072f94d29281cffd99e46c1539849f248c4b56ae7684c1f36626797fee375170
|
||||
F src/pcache1.c 716975564c15eb6679e97f734cec1bfd6c16ac3d4010f05f1f8e509fc7d19880
|
||||
F src/pragma.c bea56df3ae0637768c0da4fbbb8f2492f780980d95000034a105ff291bf7ca69
|
||||
F src/pragma.h bb83728944b42f6d409c77f5838a8edbdb0fe83046c5496ffc9602b40340a324
|
||||
F src/prepare.c d16cb8a553c09bc0c46c33f8e0add77c8f755cfb4681ca5101aaff3a04df9625
|
||||
F src/pragma.h f1e9f51dcd93188cd0b2eb8a616eaf3e79e17c3279f68aec8d0bd49546dcb909
|
||||
F src/prepare.c 1492a2bed7bc5770c5850404f09bf887a67d4580985b8cee37bdab2ea809f479
|
||||
F src/printf.c d3b7844ddeb11fbbdd38dd84d09c9c1ac171d21fb038473c3aa97981201cc660
|
||||
F src/random.c 80f5d666f23feb3e6665a6ce04c7197212a88384
|
||||
F src/resolve.c 6415381a0e9d22c0e7cba33ca4a53f81474190862f5d4838190f5eb5b0b47bc9
|
||||
@ -497,7 +497,7 @@ F src/shell.c.in d63f06c870ec1761ea98bd1cae651ff0ea6beadf8be892105dabd913f94cb3d
|
||||
F src/sqlite.h.in 8e70752a57597c08f64f3d49fc1fc46926b862d2e23b038b0d23b9cc748d88ea
|
||||
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
|
||||
F src/sqlite3ext.h 83a3c4ce93d650bedfd1aa558cb85a516bd6d094445ee989740827d0d944368d
|
||||
F src/sqliteInt.h c1deb023eb117b4437a69d8c5a753deb36581f1933015cd262ad32b45c4d8431
|
||||
F src/sqliteInt.h 8ac0138eae10337b745b03dad0124fd63ae911c0503e795729503e7fc6234d57
|
||||
F src/sqliteLimit.h 1513bfb7b20378aa0041e7022d04acb73525de35b80b252f1b83fedb4de6a76b
|
||||
F src/status.c 46e7aec11f79dad50965a5ca5fa9de009f7d6bde08be2156f1538a0a296d4d0e
|
||||
F src/table.c b46ad567748f24a326d9de40e5b9659f96ffff34
|
||||
@ -1658,7 +1658,7 @@ F tool/mkmsvcmin.tcl cad0c7b54d7dd92bc87d59f36d4cc4f070eb2e625f14159dc2f5c4204e6
|
||||
F tool/mkopcodec.tcl d1b6362bd3aa80d5520d4d6f3765badf01f6c43c
|
||||
F tool/mkopcodeh.tcl 4ee2a30ccbd900dc4d5cdb61bdab87cd2166cd2affcc78c9cc0b8d22a65b2eee
|
||||
F tool/mkopts.tcl 680f785fdb09729fd9ac50632413da4eadbdf9071535e3f26d03795828ab07fa
|
||||
F tool/mkpragmatab.tcl 2144bc8550a6471a029db262a132d2df4b9e0db61b90398bf64f5b7b3f8d92cd
|
||||
F tool/mkpragmatab.tcl c2efde2e98beee55f04679cac652a1a6291b6e47e3b0c5b86f53b84c174d9b5e
|
||||
F tool/mkshellc.tcl 1f45770aea226ac093a9c72f718efbb88a2a2833409ec2e1c4cecae4202626f5
|
||||
F tool/mksourceid.c d458f9004c837bee87a6382228ac20d3eae3c49ea3b0a5aace936f8b60748d3b
|
||||
F tool/mkspeedsql.tcl a1a334d288f7adfe6e996f2e712becf076745c97
|
||||
@ -1725,7 +1725,10 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
|
||||
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
||||
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
||||
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
||||
P 462b52b121c1882e0eca819bc30c0f6e94d7fdd60047d2c32adeff3a1eb70546
|
||||
R 330eca5f95eacfc2db564f6137a9dfe2
|
||||
U dan
|
||||
Z a32eb6502eb10fd4922091ca79205291
|
||||
P 576a8f69ae25883f752e58953624e9f7126db998bebaa1f07f7c2ec47aaecabe
|
||||
R 20267b33ec4093cbd8eada610413a5f9
|
||||
T *branch * reset-database
|
||||
T *sym-reset-database *
|
||||
T -sym-trunk *
|
||||
U drh
|
||||
Z 6b0d829800a54a9640942b2a1f1f52ea
|
||||
|
@ -1 +1 @@
|
||||
576a8f69ae25883f752e58953624e9f7126db998bebaa1f07f7c2ec47aaecabe
|
||||
02e1a13c1f04bb72599b98f51240c78d0d050de264fef5808fd97db3f4c16dac
|
@ -2972,6 +2972,10 @@ static void setDefaultSyncFlag(BtShared *pBt, u8 safety_level){
|
||||
# define setDefaultSyncFlag(pBt,safety_level)
|
||||
#endif
|
||||
|
||||
/* Forward declaration */
|
||||
static int newDatabase(BtShared*);
|
||||
|
||||
|
||||
/*
|
||||
** Get a reference to pPage1 of the database file. This will
|
||||
** also acquire a readlock on that file.
|
||||
@ -3003,6 +3007,9 @@ static int lockBtree(BtShared *pBt){
|
||||
if( nPage==0 || memcmp(24+(u8*)pPage1->aData, 92+(u8*)pPage1->aData,4)!=0 ){
|
||||
nPage = nPageFile;
|
||||
}
|
||||
if( (pBt->db->flags & SQLITE_ResetDatabase)!=0 ){
|
||||
nPage = 0;
|
||||
}
|
||||
if( nPage>0 ){
|
||||
u32 pageSize;
|
||||
u32 usableSize;
|
||||
|
@ -506,6 +506,11 @@ static const PragmaName aPragmaName[] = {
|
||||
/* iArg: */ 0 },
|
||||
#endif
|
||||
#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
|
||||
{/* zName: */ "reset_database",
|
||||
/* ePragTyp: */ PragTyp_FLAG,
|
||||
/* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1,
|
||||
/* ColNames: */ 0, 0,
|
||||
/* iArg: */ SQLITE_WriteSchema|SQLITE_ResetDatabase },
|
||||
{/* zName: */ "reverse_unordered_selects",
|
||||
/* ePragTyp: */ PragTyp_FLAG,
|
||||
/* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1,
|
||||
@ -646,4 +651,4 @@ static const PragmaName aPragmaName[] = {
|
||||
/* iArg: */ SQLITE_WriteSchema },
|
||||
#endif
|
||||
};
|
||||
/* Number of pragmas: 60 on by default, 77 total. */
|
||||
/* Number of pragmas: 61 on by default, 78 total. */
|
||||
|
@ -216,6 +216,9 @@ static int sqlite3InitOne(sqlite3 *db, int iDb, char **pzErrMsg){
|
||||
for(i=0; i<ArraySize(meta); i++){
|
||||
sqlite3BtreeGetMeta(pDb->pBt, i+1, (u32 *)&meta[i]);
|
||||
}
|
||||
if( (db->flags & SQLITE_ResetDatabase)!=0 ){
|
||||
memset(meta, 0, sizeof(meta));
|
||||
}
|
||||
pDb->pSchema->schema_cookie = meta[BTREE_SCHEMA_VERSION-1];
|
||||
|
||||
/* If opening a non-empty database, check the text encoding. For the
|
||||
|
@ -1506,6 +1506,7 @@ struct sqlite3 {
|
||||
#define SQLITE_Fts3Tokenizer 0x00400000 /* Enable fts3_tokenizer(2) */
|
||||
#define SQLITE_EnableQPSG 0x00800000 /* Query Planner Stability Guarantee*/
|
||||
#define SQLITE_TriggerEQP 0x01000000 /* Show trigger EXPLAIN QUERY PLAN */
|
||||
#define SQLITE_ResetDatabase 0x02000000 /* Reset the database */
|
||||
|
||||
/* Flags used only if debugging */
|
||||
#ifdef SQLITE_DEBUG
|
||||
|
@ -123,6 +123,11 @@ set pragma_def {
|
||||
ARG: SQLITE_WriteSchema
|
||||
IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS)
|
||||
|
||||
NAME: reset_database
|
||||
TYPE: FLAG
|
||||
ARG: SQLITE_WriteSchema|SQLITE_ResetDatabase
|
||||
IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS)
|
||||
|
||||
NAME: read_uncommitted
|
||||
TYPE: FLAG
|
||||
ARG: SQLITE_ReadUncommit
|
||||
|
Loading…
Reference in New Issue
Block a user