MCPcopy Create free account
hub / github.com/GaijinEntertainment/daScript / recoverStep

Function recoverStep

modules/dasSQLITE/sqlite/shell.c:16037–16141  ·  view source on GitHub ↗

** This function does the work of a single sqlite3_recover_step() call. It ** is guaranteed that the handle is not in an error state when this ** function is called. */

Source from the content-addressed store, hash-verified

16035** function is called.
16036*/
16037static void recoverStep(sqlite3_recover *p){
16038 assert( p && p->errCode==SQLITE_OK );
16039 switch( p->eState ){
16040 case RECOVER_STATE_INIT:
16041 /* This is the very first call to sqlite3_recover_step() on this object.
16042 */
16043 recoverSqlCallback(p, "BEGIN");
16044 recoverSqlCallback(p, "PRAGMA writable_schema = on");
16045
16046 recoverEnterMutex();
16047 recoverInstallWrapper(p);
16048
16049 /* Open the output database. And register required virtual tables and
16050 ** user functions with the new handle. */
16051 recoverOpenOutput(p);
16052
16053 /* Open transactions on both the input and output databases. */
16054 sqlite3_file_control(p->dbIn, p->zDb, SQLITE_FCNTL_RESET_CACHE, 0);
16055 recoverExec(p, p->dbIn, "PRAGMA writable_schema = on");
16056 recoverExec(p, p->dbIn, "BEGIN");
16057 if( p->errCode==SQLITE_OK ) p->bCloseTransaction = 1;
16058 recoverExec(p, p->dbIn, "SELECT 1 FROM sqlite_schema");
16059 recoverTransferSettings(p);
16060 recoverOpenRecovery(p);
16061 recoverCacheSchema(p);
16062
16063 recoverUninstallWrapper(p);
16064 recoverLeaveMutex();
16065
16066 recoverExec(p, p->dbOut, "BEGIN");
16067
16068 recoverWriteSchema1(p);
16069 p->eState = RECOVER_STATE_WRITING;
16070 break;
16071
16072 case RECOVER_STATE_WRITING: {
16073 if( p->w1.pTbls==0 ){
16074 recoverWriteDataInit(p);
16075 }
16076 if( SQLITE_DONE==recoverWriteDataStep(p) ){
16077 recoverWriteDataCleanup(p);
16078 if( p->zLostAndFound ){
16079 p->eState = RECOVER_STATE_LOSTANDFOUND1;
16080 }else{
16081 p->eState = RECOVER_STATE_SCHEMA2;
16082 }
16083 }
16084 break;
16085 }
16086
16087 case RECOVER_STATE_LOSTANDFOUND1: {
16088 if( p->laf.pUsed==0 ){
16089 recoverLostAndFound1Init(p);
16090 }
16091 if( SQLITE_DONE==recoverLostAndFound1Step(p) ){
16092 p->eState = RECOVER_STATE_LOSTANDFOUND2;
16093 }
16094 break;

Callers 1

sqlite3_recover_stepFunction · 0.85

Calls 15

assertFunction · 0.85
recoverSqlCallbackFunction · 0.85
recoverEnterMutexFunction · 0.85
recoverInstallWrapperFunction · 0.85
recoverOpenOutputFunction · 0.85
recoverExecFunction · 0.85
recoverTransferSettingsFunction · 0.85
recoverOpenRecoveryFunction · 0.85
recoverCacheSchemaFunction · 0.85
recoverUninstallWrapperFunction · 0.85
recoverLeaveMutexFunction · 0.85
recoverWriteSchema1Function · 0.85

Tested by

no test coverage detected