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

Function recoverLostAndFound2Step

modules/dasSQLITE/sqlite/shell.c:15415–15442  ·  view source on GitHub ↗

** Perform one step (sqlite3_recover_step()) of work for the connection ** passed as the only argument, which is guaranteed to be in ** RECOVER_STATE_LOSTANDFOUND2 state - during which the pages identified ** in RECOVER_STATE_LOSTANDFOUND1 are sorted into sets that likely belonged ** to the same database tree. */

Source from the content-addressed store, hash-verified

15413** to the same database tree.
15414*/
15415static int recoverLostAndFound2Step(sqlite3_recover *p){
15416 RecoverStateLAF *pLaf = &p->laf;
15417 if( p->errCode==SQLITE_OK ){
15418 int res = sqlite3_step(pLaf->pAllAndParent);
15419 if( res==SQLITE_ROW ){
15420 i64 iChild = sqlite3_column_int(pLaf->pAllAndParent, 1);
15421 if( recoverBitmapQuery(pLaf->pUsed, iChild)==0 ){
15422 sqlite3_bind_int64(pLaf->pMapInsert, 1, iChild);
15423 sqlite3_bind_value(pLaf->pMapInsert, 2,
15424 sqlite3_column_value(pLaf->pAllAndParent, 0)
15425 );
15426 sqlite3_step(pLaf->pMapInsert);
15427 recoverReset(p, pLaf->pMapInsert);
15428 sqlite3_bind_int64(pLaf->pMaxField, 1, iChild);
15429 if( SQLITE_ROW==sqlite3_step(pLaf->pMaxField) ){
15430 int nMax = sqlite3_column_int(pLaf->pMaxField, 0);
15431 if( nMax>pLaf->nMaxField ) pLaf->nMaxField = nMax;
15432 }
15433 recoverReset(p, pLaf->pMaxField);
15434 }
15435 }else{
15436 recoverFinalize(p, pLaf->pAllAndParent);
15437 pLaf->pAllAndParent =0;
15438 return SQLITE_DONE;
15439 }
15440 }
15441 return p->errCode;
15442}
15443
15444/*
15445** Free all resources allocated as part of sqlite3_recover_step() calls

Callers 1

recoverStepFunction · 0.85

Calls 3

recoverBitmapQueryFunction · 0.85
recoverResetFunction · 0.85
recoverFinalizeFunction · 0.85

Tested by

no test coverage detected