Lines Matching refs:Pgno
8119 typedef u32 Pgno;
8139 #define PAGER_MJ_PGNO(x) ((Pgno)((PENDING_BYTE/((x)->pageSize))+1))
8201 SQLITE_PRIVATE int sqlite3PagerAcquire(Pager *pPager, Pgno pgno, DbPage **ppPage, int clrFlag);
8203 SQLITE_PRIVATE DbPage *sqlite3PagerLookup(Pager *pPager, Pgno pgno);
8210 SQLITE_PRIVATE int sqlite3PagerMovepage(Pager*,DbPage*,Pgno,int);
8246 SQLITE_PRIVATE void sqlite3PagerTruncateImage(Pager*,Pgno);
8254 SQLITE_PRIVATE Pgno sqlite3PagerPagenumber(DbPage*);
8301 Pgno pgno; /* Page number for this page */
8360 SQLITE_PRIVATE int sqlite3PcacheFetch(PCache*, Pgno, int createFlag, PgHdr**);
8369 SQLITE_PRIVATE void sqlite3PcacheMove(PgHdr*, Pgno);
8371 /* Remove all pages with pgno>x. Reset the cache if x==0 */
8372 SQLITE_PRIVATE void sqlite3PcacheTruncate(PCache*, Pgno x);
11115 SQLITE_PRIVATE void sqlite3BackupUpdate(sqlite3_backup *, Pgno, const u8 *);
32953 if( p->pgno==1 ){
33028 Pgno pgno, /* Page number to obtain */
33037 assert( pgno>0 );
33056 pPage = sqlite3GlobalConfig.pcache.xFetch(pCache->pCache, pgno, eCreate);
33084 pPage = sqlite3GlobalConfig.pcache.xFetch(pCache->pCache, pgno, 2);
33094 pPage->pgno = pgno;
33097 assert( pPage->pgno==pgno );
33105 if( pgno==1 ){
33154 if( p->pgno==1 ){
33211 SQLITE_PRIVATE void sqlite3PcacheMove(PgHdr *p, Pgno newPgno){
33215 sqlite3GlobalConfig.pcache.xRekey(pCache->pCache, p, p->pgno, newPgno);
33216 p->pgno = newPgno;
33224 ** Drop every cache entry whose page number is greater than "pgno". The
33226 ** other than page 1 with a page number greater than pgno.
33228 ** If there is a reference to page 1 and the pgno parameter passed to this
33232 SQLITE_PRIVATE void sqlite3PcacheTruncate(PCache *pCache, Pgno pgno){
33238 /* This routine never gets call with a positive pgno except right
33240 ** it must be that pgno==0.
33242 assert( p->pgno>0 );
33243 if( ALWAYS(p->pgno>pgno) ){
33248 if( pgno==0 && pCache->pPage1 ){
33250 pgno = 1;
33252 sqlite3GlobalConfig.pcache.xTruncate(pCache->pCache, pgno+1);
33273 ** Merge two lists of pages connected by pDirty and in pgno order.
33280 if( pA->pgno<pB->pgno ){
33301 ** Sort the list of pages in accending order by pgno. Pages are
34774 SQLITE_PRIVATE int sqlite3WalRead(Wal *pWal, Pgno pgno, int *pInWal, int nOut, u8 *pOut);
34777 SQLITE_PRIVATE Pgno sqlite3WalDbsize(Wal *pWal);
34784 SQLITE_PRIVATE int sqlite3WalUndo(Wal *pWal, int (*xUndo)(void *, Pgno), void *pUndoCtx);
34795 SQLITE_PRIVATE int sqlite3WalFrames(Wal *pWal, int, PgHdr *, Pgno, int, int);
35253 Pgno nOrig; /* Original number of pages in file */
35254 Pgno iSubRec; /* Index of first record in sub-journal */
35444 Pgno dbSize; /* Number of pages in the database */
35445 Pgno dbOrigSize; /* dbSize before the current transaction */
35446 Pgno dbFileSize; /* Number of pages in the database file */
35447 Pgno dbHintSize; /* Value passed to FCNTL_SIZE_HINT call */
35471 Pgno mxPgno; /* Maximum allowed size of the database */
35483 void *(*xCodec)(void*,void*,Pgno,int); /* Routine for en/decoding data */
35797 Pgno pgno = pPg->pgno;
35802 if( p->nOrig>=pgno && 0==sqlite3BitvecTest(p->pInSavepoint, pgno) ){
35813 return sqlite3BitvecTest(pPg->pPager->pInJournal, pPg->pgno);
36455 static PgHdr *pager_lookup(Pager *pPager, Pgno pgno){
36461 (void)sqlite3PcacheFetch(pPager->pPCache, pgno, 0, &p);
36493 ** Set the bit number pgno in the PagerSavepoint.pInSavepoint
36497 static int addToSavepointBitvecs(Pager *pPager, Pgno pgno){
36503 if( pgno<=p->nOrig ){
36504 rc |= sqlite3BitvecSet(p->pInSavepoint, pgno);
36909 Pgno pgno; /* The page number of a page in journal */
36939 rc = read32bits(jfd, *pOffset, &pgno);
36950 if( pgno==0 || pgno==PAGER_MJ_PGNO(pPager) ){
36954 if( pgno>(Pgno)pPager->dbSize || sqlite3BitvecTest(pDone, pgno) ){
36968 if( pDone && (rc = sqlite3BitvecSet(pDone, pgno))!=SQLITE_OK ){
36974 if( pgno==1 && pPager->nReserve!=((u8*)aData)[20] ){
37017 pPg = pager_lookup(pPager, pgno);
37022 PAGERID(pPager), pgno, pager_datahash(pPager->pageSize, (u8*)aData),
37034 i64 ofst = (pgno-1)*(i64)pPager->pageSize;
37038 if( pgno>pPager->dbFileSize ){
37039 pPager->dbFileSize = pgno;
37042 CODEC1(pPager, aData, pgno, 3, rc=SQLITE_NOMEM);
37043 sqlite3BackupUpdate(pPager->pBackup, pgno, (u8*)aData);
37044 CODEC2(pPager, aData, pgno, 7, rc=SQLITE_NOMEM, aData);
37066 rc = sqlite3PagerAcquire(pPager, pgno, &pPg, 1);
37111 if( pgno==1 ){
37116 CODEC1(pPager, pData, pPg->pgno, 3, rc=SQLITE_NOMEM);
37275 static int pager_truncate(Pager *pPager, Pgno nPage){
37397 Pgno mxPg = 0; /* Size of the original file in pages */
37595 Pgno pgno = pPg->pgno; /* Page number to read */
37611 rc = sqlite3WalRead(pPager->pWal, pgno, &isInWal, pgsz, pPg->pData);
37614 i64 iOffset = (pgno-1)*(i64)pPager->pageSize;
37621 if( pgno==1 ){
37641 CODEC1(pPager, pPg->pData, pgno, 3, rc = SQLITE_NOMEM);
37645 IOTRACE(("PGIN %p %d\n", pPager, pgno));
37647 pgno, pager_pagehash(pPg)));
37665 static int pagerUndoCallback(void *pCtx, Pgno iPg){
37715 rc = pagerUndoCallback((void *)pPager, pList->pgno);
37757 Pgno nTruncate, /* Database size after this commit */
37770 assert( p->pgno < p->pDirty->pgno );
37774 if( pList->pgno==1 ) pager_write_changecounter(pList);
37781 sqlite3BackupUpdate(pPager->pBackup, p->pgno, (u8 *)p->pData);
37834 static int pagerPagecount(Pager *pPager, Pgno *pnPage){
37835 Pgno nPage; /* Value to return via *pnPage */
37862 nPage = (Pgno)(n / pPager->pageSize);
37873 pPager->mxPgno = (Pgno)nPage;
37906 Pgno nPage; /* Size of the database file */
38285 pPager->dbSize = (Pgno)(nByte/pageSize);
38462 assert( !subjRequiresPage(pPg) || pPg->pgno<=pPg->pPager->dbSize );
38477 SQLITE_PRIVATE void sqlite3PagerTruncateImage(Pager *pPager, Pgno nPage){
38579 SQLITE_PRIVATE Pgno sqlite3PagerPagenumber(DbPage *pPg){
38580 return pPg->pgno;
38797 Pgno pgno = pList->pgno;
38807 if( pgno<=pPager->dbSize && 0==(pList->flags&PGHDR_DONT_WRITE) ){
38808 i64 offset = (pgno-1)*(i64)pPager->pageSize; /* Offset to write */
38812 if( pList->pgno==1 ) pager_write_changecounter(pList);
38815 CODEC2(pPager, pList->pData, pgno, 6, return SQLITE_NOMEM, pData);
38824 if( pgno==1 ){
38827 if( pgno>pPager->dbFileSize ){
38828 pPager->dbFileSize = pgno;
38832 sqlite3BackupUpdate(pPager->pBackup, pgno, (u8*)pList->pData);
38835 PAGERID(pPager), pgno, pager_pagehash(pList)));
38836 IOTRACE(("PGOUT %p %d\n", pPager, pgno));
38840 PAGERTRACE(("NOSTORE %d page %d\n", PAGERID(pPager), pgno));
38874 ** If successful, set the bit corresponding to pPg->pgno in the bitvecs
38893 || pPg->pgno>pPager->dbOrigSize
38904 CODEC2(pPager, pData, pPg->pgno, 7, return SQLITE_NOMEM, pData2);
38905 PAGERTRACE(("STMT-JOURNAL %d page %d\n", PAGERID(pPager), pPg->pgno));
38906 rc = write32bits(pPager->sjfd, offset, pPg->pgno);
38915 rc = addToSavepointBitvecs(pPager, pPg->pgno);
39013 rc==SQLITE_OK && pPg->pgno>pPager->dbSize && subjRequiresPage(pPg)
39027 PAGERTRACE(("STRESS %d page %d\n", PAGERID(pPager), pPg->pgno));
39389 Pgno nPage; /* Number of pages in database file */
39628 Pgno nPage = 0;
39693 ** Acquire a reference to page number pgno in pager pPager (a page
39725 ** to pgno in Pager.pInJournal (bitvec of pages already written to the
39744 Pgno pgno, /* Page number to fetch */
39754 if( pgno==0 ){
39763 rc = sqlite3PcacheFetch(pPager->pPCache, pgno, 1, ppPage);
39773 assert( (*ppPage)->pgno==pgno );
39779 assert( pgno<=PAGER_MAX_PGNO && pgno!=PAGER_MJ_PGNO(pPager) );
39793 if( pgno>PAGER_MAX_PGNO || pgno==PAGER_MJ_PGNO(pPager) ){
39798 if( MEMDB || pPager->dbSize<pgno || noContent || !isOpen(pPager->fd) ){
39799 if( pgno>pPager->mxPgno ){
39811 if( pgno<=pPager->dbOrigSize ){
39812 TESTONLY( rc = ) sqlite3BitvecSet(pPager->pInJournal, pgno);
39815 TESTONLY( rc = ) addToSavepointBitvecs(pPager, pgno);
39820 IOTRACE(("ZERO %p %d\n", pPager, pgno));
39855 SQLITE_PRIVATE DbPage *sqlite3PagerLookup(Pager *pPager, Pgno pgno){
39858 assert( pgno!=0 );
39861 sqlite3PcacheFetch(pPager->pPCache, pgno, 0, &pPg);
40114 if( pPg->pgno<=pPager->dbOrigSize && isOpen(pPager->jfd) ){
40122 assert( pPg->pgno!=PAGER_MJ_PGNO(pPager) );
40125 CODEC2(pPager, pData, pPg->pgno, 7, return SQLITE_NOMEM, pData2);
40137 rc = write32bits(pPager->jfd, iOff, pPg->pgno);
40144 IOTRACE(("JOUT %p %d %lld %d\n", pPager, pPg->pgno,
40148 PAGERID(pPager), pPg->pgno,
40154 rc = sqlite3BitvecSet(pPager->pInJournal, pPg->pgno);
40157 rc |= addToSavepointBitvecs(pPager, pPg->pgno);
40167 PAGERID(pPager), pPg->pgno,
40184 if( pPager->dbSize<pPg->pgno ){
40185 pPager->dbSize = pPg->pgno;
40209 Pgno nPagePerSector = (pPager->sectorSize/pPager->pageSize);
40216 Pgno nPageCount; /* Total number of pages in database file */
40217 Pgno pg1; /* First page of the sector pPg is located on. */
40234 pg1 = ((pPg->pgno-1) & ~(nPagePerSector-1)) + 1;
40237 if( pPg->pgno>nPageCount ){
40238 nPage = (pPg->pgno - pg1)+1;
40245 assert(pg1<=pPg->pgno);
40246 assert((pg1+nPage)>pPg->pgno);
40249 Pgno pg = pg1+ii;
40251 if( pg==pPg->pgno || !sqlite3BitvecTest(pPager->pInJournal, pg) ){
40323 PAGERTRACE(("DONT_WRITE page %d of %d\n", pPg->pgno, PAGERID(pPager)));
40324 IOTRACE(("CLEAN %p %d\n", pPager, pPg->pgno))
40597 Pgno i; /* Iterator variable */
40598 const Pgno iSkip = PAGER_MJ_PGNO(pPager); /* Pending lock page */
40599 const Pgno dbSize = pPager->dbSize; /* Database image size */
40647 Pgno nNew = pPager->dbSize - (pPager->dbSize==PAGER_MJ_PGNO(pPager));
41023 void *(*xCodec)(void*,void*,Pgno,int),
41042 ** Move the page pPg to location pgno in the file.
41045 ** pgno (which we call pPgOld) though that page is allowed to be
41046 ** in cache. If the page previously located at pgno is not already
41066 SQLITE_PRIVATE int sqlite3PagerMovepage(Pager *pPager, DbPage *pPg, Pgno pgno, int isCommit){
41068 Pgno needSyncPgno = 0; /* Old value of pPg->pgno, if sync is required */
41070 Pgno
41100 ** subjournalPage() may need to allocate space to store pPg->pgno into
41112 PAGERID(pPager), pPg->pgno, (pPg->flags&PGHDR_NEED_SYNC)?1:0, pgno));
41113 IOTRACE(("MOVE %p %d %d\n", pPager, pPg->pgno, pgno))
41115 /* If the journal needs to be sync()ed before page pPg->pgno can
41116 ** be written to, store pPg->pgno in local variable needSyncPgno.
41119 ** the journal needs to be sync()ed before database page pPg->pgno
41123 needSyncPgno = pPg->pgno;
41124 assert( pageInJournal(pPg) || pPg->pgno>pPager->dbOrigSize );
41128 /* If the cache contains a page with page-number pgno, remove it
41130 ** page pgno before the 'move' operation, it needs to be retained
41134 pPgOld = pager_lookup(pPager, pgno);
41147 origPgno = pPg->pgno;
41148 sqlite3PcacheMove(pPg, pgno);
41567 CODEC2(pPg->pPager, pPg->pData, pPg->pgno, 6, return 0, aData);
42263 u32 pgno; /* Page number of the frame */
42275 pgno = sqlite3Get4byte(&aFrame[0]);
42276 if( pgno==0 ){
42298 *piPage = pgno;
42716 u32 pgno; /* Database page number for frame */
42723 isValid = walDecodeFrame(pWal, &pgno, &nTruncate, aData, aFrame);
42725 rc = walIndexAppend(pWal, ++iFrame, pgno);
42881 u32 iMin; /* Result pgno must be greater than iMin */
42926 Pgno dbpage;
43709 Pgno pgno, /* Database page number to read data for */
43733 ** pgno. Each iteration of the following for() loop searches one
43750 ** (aPgno[iFrame]==pgno):
43770 for(iKey=walHash(pgno); aHash[iKey]; iKey=walNextHash(iKey)){
43772 if( iFrame<=iLast && aPgno[aHash[iKey]]==pgno ){
43790 if( walFramePgno(pWal, iTest)==pgno ){
43823 SQLITE_PRIVATE Pgno sqlite3WalDbsize(Wal *pWal){
43901 SQLITE_PRIVATE int sqlite3WalUndo(Wal *pWal, int (*xUndo)(void *, Pgno), void *pUndoCtx){
43904 Pgno iMax = pWal->hdr.mxFrame;
43905 Pgno iFrame;
44053 Pgno nTruncate, /* Database size after this commit */
44129 walEncodeFrame(pWal, p->pgno, nDbsize, pData, aFrame);
44159 walEncodeFrame(pWal, pLast->pgno, nTruncate, pData, aFrame);
44185 rc = walIndexAppend(pWal, iFrame, p->pgno);
44190 rc = walIndexAppend(pWal, iFrame, pLast->pgno);
44662 Pgno pgno; /* Page number for this page */
44681 Pgno iTable; /* Root page of table */
44858 Pgno pgnoRoot; /* The root page of this tree */
44870 Pgno *aOverflow; /* Cache of overflow page locations */
44922 ** If the pgno argument passed to PTRMAP_PAGENO is a pointer-map page,
44923 ** then pgno is returned. So (pgno==PTRMAP_PAGENO(pgsz, pgno)) can be
44924 ** used to test if pgno is a pointer-map page. PTRMAP_ISPAGE implements
44927 #define PTRMAP_PAGENO(pBt, pgno) ptrmapPageno(pBt, pgno)
44928 #define PTRMAP_PTROFFSET(pgptrmap, pgno) (5*(pgno-pgptrmap-1))
44929 #define PTRMAP_ISPAGE(pBt, pgno) (PTRMAP_PAGENO((pBt),(pgno))==(pgno))
44998 Pgno nPage; /* Number of pages in the database */
45480 Pgno iRoot, /* Root page of b-tree */
45485 Pgno iTab = 0;
45559 static int hasReadConflicts(Btree *pBtree, Pgno iRoot){
45579 static int querySharedCacheTableLock(Btree *p, Pgno iTab, u8 eLock){
45651 static int setSharedCacheTableLock(Btree *p, Pgno iTable, u8 eLock){
45848 ** Set bit pgno of the BtShared.pHasContent bitvec. This is called
45882 static int btreeSetHasContent(BtShared *pBt, Pgno pgno){
45885 assert( pgno<=pBt->nPage );
45891 if( rc==SQLITE_OK && pgno<=sqlite3BitvecSize(pBt->pHasContent) ){
45892 rc = sqlite3BitvecSet(pBt->pHasContent, pgno);
45904 static int btreeGetHasContent(BtShared *pBt, Pgno pgno){
45906 return (p && (pgno>sqlite3BitvecSize(p) || sqlite3BitvecTest(p, pgno)));
45975 static int saveAllCursors(BtShared *pBt, Pgno iRoot, BtCursor *pExcept){
46091 ** Return 0 (not a valid page) for pgno==1 since there is
46095 static Pgno ptrmapPageno(BtShared *pBt, Pgno pgno){
46097 Pgno iPtrMap, ret;
46099 if( pgno<2 ) return 0;
46101 iPtrMap = (pgno-2)/nPagesPerMapPage;
46113 ** so that it maps to type 'eType' and parent page number 'pgno'.
46119 static void ptrmapPut(BtShared *pBt, Pgno key, u8 eType, Pgno parent, int *pRC){
46122 Pgno iPtrmap; /* The pointer map page number */
46170 static int ptrmapGet(BtShared *pBt, Pgno key, u8 *pEType, Pgno *pPgno){
46404 Pgno ovfl = get4byte(&pCell[info.iOverflow]);
46405 ptrmapPut(pPage->pBt, ovfl, PTRMAP_OVERFLOW1, pPage->pgno, pRC);
46702 assert( pPage->hdrOffset==(pPage->pgno==1 ? 100 : 0) );
46737 assert( pPage->pgno==sqlite3PagerPagenumber(pPage->pDbPage) );
46849 assert( sqlite3PagerPagenumber(pPage->pDbPage)==pPage->pgno );
46878 static MemPage *btreePageFromDbPage(DbPage *pDbPage, Pgno pgno, BtShared *pBt){
46883 pPage->pgno = pgno;
46884 pPage->hdrOffset = pPage->pgno==1 ? 100 : 0;
46901 Pgno pgno, /* Number of the page to fetch */
46909 rc = sqlite3PagerAcquire(pBt->pPager, pgno, (DbPage**)&pDbPage, noContent);
46911 *ppPage = btreePageFromDbPage(pDbPage, pgno, pBt);
46920 static MemPage *btreePageLookup(BtShared *pBt, Pgno pgno){
46923 pDbPage = sqlite3PagerLookup(pBt->pPager, pgno);
46925 return btreePageFromDbPage(pDbPage, pgno, pBt);
46934 static Pgno btreePagecount(BtShared *pBt){
46953 Pgno pgno, /* Number of the page to get */
46959 if( pgno>btreePagecount(pBt) ){
46962 rc = btreeGetPage(pBt, pgno, ppPage, 0);
46971 testcase( pgno==0 );
46972 assert( pgno!=0 || rc==SQLITE_CORRUPT );
47176 assert( sizeof(Pgno)==4 );
48034 Pgno pgno = pPage->pgno;
48049 Pgno childPgno = get4byte(pCell);
48050 ptrmapPut(pBt, childPgno, PTRMAP_BTREE, pgno, &rc);
48055 Pgno childPgno = get4byte(&pPage->aData[pPage->hdrOffset+8]);
48056 ptrmapPut(pBt, childPgno, PTRMAP_BTREE, pgno, &rc);
48078 static int modifyPagePointer(MemPage *pPage, Pgno iFrom, Pgno iTo, u8 eType){
48133 ** the journal needs to be sync()ed before database page pDbPage->pgno
48141 Pgno iPtrPage, /* Pointer map 'page-no' entry for pDbPage */
48142 Pgno iFreePage, /* The location to move pDbPage to */
48146 Pgno iDbPage = pDbPage->pgno;
48162 pDbPage->pgno = iFreePage;
48178 Pgno nextOvfl = get4byte(pDbPage->aData);
48211 static int allocateBtreePage(BtShared *, MemPage **, Pgno *, Pgno, u8);
48231 static int incrVacuumStep(BtShared *pBt, Pgno nFin, Pgno iLastPg){
48232 Pgno nFreeList; /* Number of pages still on the free-list */
48240 Pgno iPtrPage;
48262 Pgno iFreePg;
48272 Pgno iFreePg; /* Index of free page to move pLastPg to */
48378 Pgno nFin; /* Number of pages in database after autovacuuming */
48379 Pgno nFree; /* Number of pages on the freelist initially */
48380 Pgno nPtrmap; /* Number of PtrMap pages to be freed */
48381 Pgno iFree; /* The next page to be freed */
48383 Pgno nOrig; /* Database size before freeing */
48819 pCur->pgnoRoot = (Pgno)iTable;
49057 Pgno ovfl, /* Current overflow page number */
49059 Pgno *pPgnoNext /* OUT: Next overflow page number */
49061 Pgno next = 0;
49076 Pgno pgno;
49077 Pgno iGuess = ovfl+1;
49085 rc = ptrmapGet(pBt, iGuess, &eType, &pgno);
49086 if( rc==SQLITE_OK && eType==PTRMAP_OVERFLOW2 && pgno==ovfl ){
49218 Pgno nextPage;
49232 pCur->aOverflow = (Pgno *)sqlite3MallocZero(sizeof(Pgno)*nOvfl);
49487 static void assertParentIndex(MemPage *pParent, int iIdx, Pgno iChild){
49515 pCur->apPage[pCur->iPage]->pgno
49593 assert( pRoot->pgno==pCur->pgnoRoot );
49602 Pgno subpage;
49603 if( pRoot->pgno!=1 ) return SQLITE_CORRUPT_BKPT;
49621 Pgno pgno;
49629 pgno = get4byte(findCell(pPage, pCur->aiIdx[pCur->iPage]));
49630 rc = moveToChild(pCur, pgno);
49646 Pgno pgno;
49653 pgno = get4byte(&pPage->aData[pPage->hdrOffset+8]);
49655 rc = moveToChild(pCur, pgno);
49800 Pgno chldPg;
50101 Pgno *pPgno,
50102 Pgno nearby,
50111 Pgno mxPage; /* Total size of the database file */
50123 Pgno iTrunk;
50220 Pgno iNewTrunk = get4byte(&pTrunk->aData[8]);
50256 Pgno iPage;
50292 *pPgno, closest+1, k, pTrunk->pgno, n-1));
50381 static int freePage2(BtShared *pBt, MemPage *pMemPage, Pgno iPage){
50383 Pgno iTrunk = 0; /* Page number of free-list trunk page */
50391 assert( !pMemPage || pMemPage->pgno==iPage );
50472 TRACE(("FREE-PAGE: %d leaf on trunk page %d\n",pPage->pgno,pTrunk->pgno));
50493 TRACE(("FREE-PAGE: %d new trunk page replacing %d\n", pPage->pgno, iTrunk));
50505 *pRC = freePage2(pPage->pBt, pPage, pPage->pgno);
50515 Pgno ovflPgno;
50531 Pgno iNext = 0;
50600 Pgno pgnoOvfl = 0;
50649 Pgno pgnoPtrmap = pgnoOvfl; /* Overflow page pointer-map entry page */
50802 Pgno iChild, /* If non-zero, replace first 4 bytes with this value */
50963 Pgno pgnoNew; /* Page number of pNew */
51000 ptrmapPut(pBt, pgnoNew, PTRMAP_BTREE, pParent->pgno, &rc);
51027 0, pPage->pgno, &rc);
51049 Pgno n;
51062 Pgno ovfl = get4byte(&z[info.iOverflow]);
51064 assert( n==pPage->pgno && e==PTRMAP_OVERFLOW1 );
51067 Pgno child = get4byte(z);
51069 assert( n==pPage->pgno && e==PTRMAP_BTREE );
51073 Pgno child = get4byte(&pPage->aData[pPage->hdrOffset+8]);
51075 assert( n==pPage->pgno && e==PTRMAP_BTREE );
51105 int const iToHdr = ((pTo->pgno==1) ? 100 : 0);
51212 Pgno pgno; /* Temp var to store a page number in */
51219 TRACE(("BALANCE: begin page %d child of %d\n", pPage->pgno, pParent->pgno));
51265 pgno = get4byte(pRight);
51267 rc = getAndInitPage(pBt, pgno, &apOld[i]);
51277 pgno = get4byte(apDiv[i]);
51282 pgno = get4byte(apDiv[i]);
51469 assert( cntNew[0]>0 || (pParent->pgno==1 && pParent->nCell==0) );
51472 apOld[0]->pgno,
51473 nOld>=2 ? apOld[1]->pgno : 0,
51474 nOld>=3 ? apOld[2]->pgno : 0
51480 if( apOld[0]->pgno<=1 ){
51495 rc = allocateBtreePage(pBt, &pNew, &pgno, pgno, 0);
51502 ptrmapPut(pBt, pNew->pgno, PTRMAP_BTREE, pParent->pgno, &rc);
51535 int minV = apNew[i]->pgno;
51538 if( apNew[j]->pgno<(unsigned)minV ){
51540 minV = apNew[j]->pgno;
51546 t = apNew[i]->pgno;
51553 apNew[0]->pgno, szNew[0],
51554 nNew>=2 ? apNew[1]->pgno : 0, nNew>=2 ? szNew[1] : 0,
51555 nNew>=3 ? apNew[2]->pgno : 0, nNew>=3 ? szNew[2] : 0,
51556 nNew>=4 ? apNew[3]->pgno : 0, nNew>=4 ? szNew[3] : 0,
51557 nNew>=5 ? apNew[4]->pgno : 0, nNew>=5 ? szNew[4] : 0));
51560 put4byte(pRight, apNew[nNew-1]->pgno);
51626 insertCell(pParent, nxDiv, pCell, sz, pTemp, pNew->pgno, &rc);
51741 if( isDivider || pOld->pgno!=pNew->pgno ){
51743 ptrmapPut(pBt, get4byte(apCell[i]), PTRMAP_BTREE, pNew->pgno, &rc);
51754 ptrmapPut(pBt, key, PTRMAP_BTREE, apNew[i]->pgno, &rc);
51810 Pgno pgnoChild = 0; /* Page number of the new child page */
51822 rc = allocateBtreePage(pBt,&pChild,&pgnoChild,pRoot->pgno,0);
51825 ptrmapPut(pBt, pgnoChild, PTRMAP_BTREE, pRoot->pgno, &rc);
51837 TRACE(("BALANCE: copy root %d into %d\n", pRoot->pgno, pChild->pgno));
51904 && pParent->pgno!=1
52061 pCur->pgnoRoot, nKey, nData, pPage->pgno,
52205 Pgno n = pCur->apPage[iCellDepth+1]->pgno;
52264 Pgno pgnoRoot;
52279 Pgno pgnoMove; /* Move a page here to make room for the root-page */
52322 Pgno iPtrPage = 0;
52410 Pgno pgno, /* Page number to clear */
52420 if( pgno>btreePagecount(pBt) ){
52424 rc = getAndInitPage(pBt, pgno, &pPage);
52477 rc = saveAllCursors(pBt, (Pgno)iTable, 0);
52479 rc = clearDatabasePage(pBt, (Pgno)iTable, 0, pnChange);
52505 static int btreeDropTable(Btree *p, Pgno iTable, int *piMoved){
52526 rc = btreeGetPage(pBt, (Pgno)iTable, &pPage, 0);
52542 Pgno maxRootPgno;
52794 static int checkRef(IntegrityCk *pCheck, Pgno iPage, char *zContext){
52815 Pgno iChild, /* Child page number */
52817 Pgno iParent, /* Expected pointer map parent page number */
52822 Pgno iPtrmapParent;
52863 if( sqlite3PagerGet(pCheck->pPager, (Pgno)iPage, &pOvflPage) ){
52881 Pgno iFreePage = get4byte(&pOvflData[8+i*4]);
52937 int i, rc, depth, d2, pgno, cnt;
52956 if( (rc = btreeGetPage(pBt, (Pgno)iPage, &pPage, 0))!=0 ){
53004 Pgno pgnoOvfl = get4byte(&pCell[info.iOverflow]);
53016 pgno = get4byte(pCell);
53019 checkPtrmap(pCheck, pgno, PTRMAP_BTREE, iPage, zContext);
53022 d2 = checkTreePage(pCheck, pgno, zContext, &nMinKey, i==0 ? NULL : &nMaxKey);
53031 pgno = get4byte(&pPage->aData[pPage->hdrOffset+8]);
53036 checkPtrmap(pCheck, pgno, PTRMAP_BTREE, iPage, zContext);
53039 checkTreePage(pCheck, pgno, zContext, NULL, !pPage->nCell ? NULL : &nMaxKey);
53160 Pgno i;
53531 Pgno iNext; /* Page number of the next source page to copy */
53540 Pgno nRemaining; /* Number of pages left to copy */
53541 Pgno nPagecount; /* Total number of pages to copy */
53703 static int backupOnePage(sqlite3_backup *p, Pgno iSrcPg, const u8 *zSrcData){
53740 Pgno iDest = (Pgno)(iOff/nDestPgsz)+1;
53858 for(ii=0; (nPage<0 || ii<nPage) && p->iNext<=(Pgno)nSrcPage && !rc; ii++){
53859 const Pgno iSrcPg = p->iNext; /* Source page number */
53873 if( p->iNext>(Pgno)nSrcPage ){
53949 const Pgno iSrcPg = (Pgno)((iOff/pgszSrc)+1);
54074 SQLITE_PRIVATE void sqlite3BackupUpdate(sqlite3_backup *pBackup, Pgno iPage, const u8 *aData){
60858 int pgno;
63564 int pgno;
63566 rc = sqlite3BtreeCreateTable(u.ax.pCx->pBt, &pgno, BTREE_BLOBKEY);
63568 assert( pgno==MASTER_ROOT+1 );
63569 rc = sqlite3BtreeCursor(u.ax.pCx->pBt, pgno, 1,
65064 int pgno;
65069 u.bt.pgno = 0;
65080 rc = sqlite3BtreeCreateTable(u.bt.pDb->pBt, &u.bt.pgno, u.bt.flags);
65081 pOut->u.i = u.bt.pgno;