diff options
author | drh <drh@noemail.net> | 2015-02-06 15:40:32 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2015-02-06 15:40:32 +0000 |
commit | 1ee4a2dd88663517c8dd980926af9e76f37c88fb (patch) | |
tree | e0bac01b14814f6505c4fc563bb27376da328908 /src/main.c | |
parent | 9c2e9f7afa07a7763517f0332d3a81e3f9d01d73 (diff) | |
parent | 0e55db1cd8748942e3284eb94e774d825ff223fb (diff) | |
download | sqlite-1ee4a2dd88663517c8dd980926af9e76f37c88fb.tar.gz sqlite-1ee4a2dd88663517c8dd980926af9e76f37c88fb.zip |
Merge all the latest enhancements from trunk.
FossilOrigin-Name: ae7eef117f28a5dae7a05805f2d31ac532a9fcc5
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c index 56003af84..af5203d5d 100644 --- a/src/main.c +++ b/src/main.c @@ -1987,6 +1987,7 @@ int sqlite3_wal_checkpoint_v2( rc = SQLITE_ERROR; sqlite3ErrorWithMsg(db, SQLITE_ERROR, "unknown database: %s", zDb); }else{ + db->busyHandler.nBusy = 0; rc = sqlite3Checkpoint(db, iDb, eMode, pnLog, pnCkpt); sqlite3Error(db, rc); } @@ -3618,6 +3619,35 @@ int sqlite3_test_control(int op, ...){ if( sqlite3GlobalConfig.isInit==0 ) rc = SQLITE_ERROR; break; } + + /* sqlite3_test_control(SQLITE_TESTCTRL_IMPOSTER, db, dbName, onOff, tnum); + ** + ** This test control is used to create imposter tables. "db" is a pointer + ** to the database connection. dbName is the database name (ex: "main" or + ** "temp") which will receive the imposter. "onOff" turns imposter mode on + ** or off. "tnum" is the root page of the b-tree to which the imposter + ** table should connect. + ** + ** Enable imposter mode only when the schema has already been parsed. Then + ** run a single CREATE TABLE statement to construct the imposter table in the + ** parsed schema. Then turn imposter mode back off again. + ** + ** If onOff==0 and tnum>0 then reset the schema for all databases, causing + ** the schema to be reparsed the next time it is needed. This has the + ** effect of erasing all imposter tables. + */ + case SQLITE_TESTCTRL_IMPOSTER: { + sqlite3 *db = va_arg(ap, sqlite3*); + sqlite3_mutex_enter(db->mutex); + db->init.iDb = sqlite3FindDbName(db, va_arg(ap,const char*)); + db->init.busy = db->init.imposterTable = va_arg(ap,int); + db->init.newTnum = va_arg(ap,int); + if( db->init.busy==0 && db->init.newTnum>0 ){ + sqlite3ResetAllSchemasOfConnection(db); + } + sqlite3_mutex_leave(db->mutex); + break; + } } va_end(ap); #endif /* SQLITE_OMIT_BUILTIN_TEST */ |