1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-18 10:21:03 +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

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