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

Function recoverLostAndFound2Init

modules/dasSQLITE/sqlite/shell.c:15384–15406  ·  view source on GitHub ↗

** Initialize resources required by 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

15382** are sorted into sets that likely belonged to the same database tree.
15383*/
15384static void recoverLostAndFound2Init(sqlite3_recover *p){
15385 RecoverStateLAF *pLaf = &p->laf;
15386
15387 assert( p->laf.pAllAndParent==0 );
15388 assert( p->laf.pMapInsert==0 );
15389 assert( p->laf.pMaxField==0 );
15390 assert( p->laf.nMaxField==0 );
15391
15392 pLaf->pMapInsert = recoverPrepare(p, p->dbOut,
15393 "INSERT OR IGNORE INTO recovery.map(pgno, parent) VALUES(?, ?)"
15394 );
15395 pLaf->pAllAndParent = recoverPreparePrintf(p, p->dbOut,
15396 "WITH RECURSIVE seq(ii) AS ("
15397 " SELECT 1 UNION ALL SELECT ii+1 FROM seq WHERE ii<%lld"
15398 ")"
15399 "SELECT pgno, child FROM sqlite_dbptr('getpage()') "
15400 " UNION ALL "
15401 "SELECT NULL, ii FROM seq", p->laf.nPg
15402 );
15403 pLaf->pMaxField = recoverPreparePrintf(p, p->dbOut,
15404 "SELECT max(field)+1 FROM sqlite_dbdata('getpage') WHERE pgno = ?"
15405 );
15406}
15407
15408/*
15409** Perform one step (sqlite3_recover_step()) of work for the connection

Callers 1

recoverStepFunction · 0.85

Calls 3

assertFunction · 0.85
recoverPrepareFunction · 0.85
recoverPreparePrintfFunction · 0.85

Tested by

no test coverage detected