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

Function recoverLostAndFound3Init

modules/dasSQLITE/sqlite/shell.c:15087–15114  ·  view source on GitHub ↗

** Initialize resources required in RECOVER_STATE_LOSTANDFOUND3 ** state - during which the lost-and-found table of the output database ** is populated with recovered data that can not be assigned to any ** recovered schema object. */

Source from the content-addressed store, hash-verified

15085** recovered schema object.
15086*/
15087static void recoverLostAndFound3Init(sqlite3_recover *p){
15088 RecoverStateLAF *pLaf = &p->laf;
15089
15090 if( pLaf->nMaxField>0 ){
15091 char *zTab = 0; /* Name of lost_and_found table */
15092
15093 zTab = recoverLostAndFoundCreate(p, pLaf->nMaxField);
15094 pLaf->pInsert = recoverLostAndFoundInsert(p, zTab, pLaf->nMaxField);
15095 sqlite3_free(zTab);
15096
15097 pLaf->pAllPage = recoverPreparePrintf(p, p->dbOut,
15098 "WITH RECURSIVE seq(ii) AS ("
15099 " SELECT 1 UNION ALL SELECT ii+1 FROM seq WHERE ii<%lld"
15100 ")"
15101 "SELECT ii FROM seq" , p->laf.nPg
15102 );
15103 pLaf->pPageData = recoverPrepare(p, p->dbOut,
15104 "SELECT cell, field, value "
15105 "FROM sqlite_dbdata('getpage()') d WHERE d.pgno=? "
15106 "UNION ALL "
15107 "SELECT -1, -1, -1"
15108 );
15109
15110 pLaf->apVal = (sqlite3_value**)recoverMalloc(p,
15111 pLaf->nMaxField*sizeof(sqlite3_value*)
15112 );
15113 }
15114}
15115
15116/*
15117** Initialize resources required in RECOVER_STATE_WRITING state - during which

Callers 1

recoverStepFunction · 0.85

Calls 5

recoverPreparePrintfFunction · 0.85
recoverPrepareFunction · 0.85
recoverMallocFunction · 0.85

Tested by

no test coverage detected