1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-05 15:55:57 +03:00

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:
drh
2018-04-28 01:27:09 +00:00
parent 03db962ab5
commit 0314cf3aa5
7 changed files with 37 additions and 13 deletions

View File

@@ -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;