Lines Matching refs:pgno

8670 SQLITE_PRIVATE int sqlite3PagerAcquire(Pager *pPager, Pgno pgno, DbPage **ppPage, int clrFlag);
8672 SQLITE_PRIVATE DbPage *sqlite3PagerLookup(Pager *pPager, Pgno pgno);
8770 Pgno pgno; /* Page number for this page */ member
34814 if( p->pgno==1 ){
34889 Pgno pgno, /* Page number to obtain */
34898 assert( pgno>0 );
34917 pPage = sqlite3GlobalConfig.pcache.xFetch(pCache->pCache, pgno, eCreate);
34942 pPg->pgno, pgno,
34952 pPage = sqlite3GlobalConfig.pcache.xFetch(pCache->pCache, pgno, 2);
34962 pPage->pgno = pgno;
34965 assert( pPage->pgno==pgno );
34973 if( pgno==1 ){
35022 if( p->pgno==1 ){
35083 sqlite3GlobalConfig.pcache.xRekey(pCache->pCache, p, p->pgno, newPgno);
35084 p->pgno = newPgno;
35100 SQLITE_PRIVATE void sqlite3PcacheTruncate(PCache *pCache, Pgno pgno){
35110 assert( p->pgno>0 );
35111 if( ALWAYS(p->pgno>pgno) ){
35116 if( pgno==0 && pCache->pPage1 ){
35118 pgno = 1;
35120 sqlite3GlobalConfig.pcache.xTruncate(pCache->pCache, pgno+1);
35148 if( pA->pgno<pB->pgno ){
36760 SQLITE_PRIVATE int sqlite3WalRead(Wal *pWal, Pgno pgno, int *pInWal, int nOut, u8 *pOut);
37788 Pgno pgno = pPg->pgno;
37793 if( p->nOrig>=pgno && 0==sqlite3BitvecTest(p->pInSavepoint, pgno) ){
37804 return sqlite3BitvecTest(pPg->pPager->pInJournal, pPg->pgno);
38446 static PgHdr *pager_lookup(Pager *pPager, Pgno pgno){
38452 (void)sqlite3PcacheFetch(pPager->pPCache, pgno, 0, &p);
38488 static int addToSavepointBitvecs(Pager *pPager, Pgno pgno){
38494 if( pgno<=p->nOrig ){
38495 rc |= sqlite3BitvecSet(p->pInSavepoint, pgno);
38900 Pgno pgno; /* The page number of a page in journal */
38930 rc = read32bits(jfd, *pOffset, &pgno);
38941 if( pgno==0 || pgno==PAGER_MJ_PGNO(pPager) ){
38945 if( pgno>(Pgno)pPager->dbSize || sqlite3BitvecTest(pDone, pgno) ){
38959 if( pDone && (rc = sqlite3BitvecSet(pDone, pgno))!=SQLITE_OK ){
38965 if( pgno==1 && pPager->nReserve!=((u8*)aData)[20] ){
39008 pPg = pager_lookup(pPager, pgno);
39013 PAGERID(pPager), pgno, pager_datahash(pPager->pageSize, (u8*)aData),
39025 i64 ofst = (pgno-1)*(i64)pPager->pageSize;
39029 if( pgno>pPager->dbFileSize ){
39030 pPager->dbFileSize = pgno;
39033 CODEC1(pPager, aData, pgno, 3, rc=SQLITE_NOMEM);
39034 sqlite3BackupUpdate(pPager->pBackup, pgno, (u8*)aData);
39035 CODEC2(pPager, aData, pgno, 7, rc=SQLITE_NOMEM, aData);
39057 rc = sqlite3PagerAcquire(pPager, pgno, &pPg, 1);
39102 if( pgno==1 ){
39107 CODEC1(pPager, pData, pPg->pgno, 3, rc=SQLITE_NOMEM);
39592 Pgno pgno = pPg->pgno; /* Page number to read */
39608 rc = sqlite3WalRead(pPager->pWal, pgno, &isInWal, pgsz, pPg->pData);
39611 i64 iOffset = (pgno-1)*(i64)pPager->pageSize;
39618 if( pgno==1 ){
39638 CODEC1(pPager, pPg->pData, pgno, 3, rc = SQLITE_NOMEM);
39642 IOTRACE(("PGIN %p %d\n", pPager, pgno));
39644 PAGERID(pPager), pgno, pager_pagehash(pPg)));
39734 rc = pagerUndoCallback((void *)pPager, pList->pgno);
39766 assert( p->pgno < p->pDirty->pgno );
39778 if( p->pgno<=nTruncate ) ppNext = &p->pDirty;
39783 if( pList->pgno==1 ) pager_write_changecounter(pList);
39790 sqlite3BackupUpdate(pPager->pBackup, p->pgno, (u8 *)p->pData);
40472 assert( !subjRequiresPage(pPg) || pPg->pgno<=pPg->pPager->dbSize );
40590 return pPg->pgno;
40807 Pgno pgno = pList->pgno;
40817 if( pgno<=pPager->dbSize && 0==(pList->flags&PGHDR_DONT_WRITE) ){
40818 i64 offset = (pgno-1)*(i64)pPager->pageSize; /* Offset to write */
40822 if( pList->pgno==1 ) pager_write_changecounter(pList);
40825 CODEC2(pPager, pList->pData, pgno, 6, return SQLITE_NOMEM, pData);
40834 if( pgno==1 ){
40837 if( pgno>pPager->dbFileSize ){
40838 pPager->dbFileSize = pgno;
40842 sqlite3BackupUpdate(pPager->pBackup, pgno, (u8*)pList->pData);
40845 PAGERID(pPager), pgno, pager_pagehash(pList)));
40846 IOTRACE(("PGOUT %p %d\n", pPager, pgno));
40850 PAGERTRACE(("NOSTORE %d page %d\n", PAGERID(pPager), pgno));
40903 || pPg->pgno>pPager->dbOrigSize
40914 CODEC2(pPager, pData, pPg->pgno, 7, return SQLITE_NOMEM, pData2);
40915 PAGERTRACE(("STMT-JOURNAL %d page %d\n", PAGERID(pPager), pPg->pgno));
40916 rc = write32bits(pPager->sjfd, offset, pPg->pgno);
40925 rc = addToSavepointBitvecs(pPager, pPg->pgno);
41023 rc==SQLITE_OK && pPg->pgno>pPager->dbSize && subjRequiresPage(pPg)
41037 PAGERTRACE(("STRESS %d page %d\n", PAGERID(pPager), pPg->pgno));
41766 Pgno pgno, /* Page number to fetch */
41776 if( pgno==0 ){
41785 rc = sqlite3PcacheFetch(pPager->pPCache, pgno, 1, ppPage);
41795 assert( (*ppPage)->pgno==pgno );
41801 assert( pgno<=PAGER_MAX_PGNO && pgno!=PAGER_MJ_PGNO(pPager) );
41815 if( pgno>PAGER_MAX_PGNO || pgno==PAGER_MJ_PGNO(pPager) ){
41820 if( MEMDB || pPager->dbSize<pgno || noContent || !isOpen(pPager->fd) ){
41821 if( pgno>pPager->mxPgno ){
41833 if( pgno<=pPager->dbOrigSize ){
41834 TESTONLY( rc = ) sqlite3BitvecSet(pPager->pInJournal, pgno);
41837 TESTONLY( rc = ) addToSavepointBitvecs(pPager, pgno);
41842 IOTRACE(("ZERO %p %d\n", pPager, pgno));
41877 SQLITE_PRIVATE DbPage *sqlite3PagerLookup(Pager *pPager, Pgno pgno){
41880 assert( pgno!=0 );
41883 sqlite3PcacheFetch(pPager->pPCache, pgno, 0, &pPg);
42136 if( pPg->pgno<=pPager->dbOrigSize && isOpen(pPager->jfd) ){
42144 assert( pPg->pgno!=PAGER_MJ_PGNO(pPager) );
42147 CODEC2(pPager, pData, pPg->pgno, 7, return SQLITE_NOMEM, pData2);
42159 rc = write32bits(pPager->jfd, iOff, pPg->pgno);
42166 IOTRACE(("JOUT %p %d %lld %d\n", pPager, pPg->pgno,
42170 PAGERID(pPager), pPg->pgno,
42176 rc = sqlite3BitvecSet(pPager->pInJournal, pPg->pgno);
42179 rc |= addToSavepointBitvecs(pPager, pPg->pgno);
42189 PAGERID(pPager), pPg->pgno,
42206 if( pPager->dbSize<pPg->pgno ){
42207 pPager->dbSize = pPg->pgno;
42256 pg1 = ((pPg->pgno-1) & ~(nPagePerSector-1)) + 1;
42259 if( pPg->pgno>nPageCount ){
42260 nPage = (pPg->pgno - pg1)+1;
42267 assert(pg1<=pPg->pgno);
42268 assert((pg1+nPage)>pPg->pgno);
42273 if( pg==pPg->pgno || !sqlite3BitvecTest(pPager->pInJournal, pg) ){
42345 PAGERTRACE(("DONT_WRITE page %d of %d\n", pPg->pgno, PAGERID(pPager)));
42346 IOTRACE(("CLEAN %p %d\n", pPager, pPg->pgno))
43109 SQLITE_PRIVATE int sqlite3PagerMovepage(Pager *pPager, DbPage *pPg, Pgno pgno, int isCommit){
43155 PAGERID(pPager), pPg->pgno, (pPg->flags&PGHDR_NEED_SYNC)?1:0, pgno));
43156 IOTRACE(("MOVE %p %d %d\n", pPager, pPg->pgno, pgno))
43166 needSyncPgno = pPg->pgno;
43167 assert( pageInJournal(pPg) || pPg->pgno>pPager->dbOrigSize );
43177 pPgOld = pager_lookup(pPager, pgno);
43190 origPgno = pPg->pgno;
43191 sqlite3PcacheMove(pPg, pgno);
43618 CODEC2(pPg->pPager, pPg->pData, pPg->pgno, 6, return 0, aData);
44326 u32 pgno; /* Page number of the frame */
44338 pgno = sqlite3Get4byte(&aFrame[0]);
44339 if( pgno==0 ){
44361 *piPage = pgno;
44779 u32 pgno; /* Database page number for frame */
44786 isValid = walDecodeFrame(pWal, &pgno, &nTruncate, aData, aFrame);
44788 rc = walIndexAppend(pWal, ++iFrame, pgno);
45874 Pgno pgno, /* Database page number to read data for */
45935 for(iKey=walHash(pgno); aHash[iKey]; iKey=walNextHash(iKey)){
45937 if( iFrame<=iLast && aPgno[aHash[iKey]]==pgno ){
45955 if( walFramePgno(pWal, iTest)==pgno ){
46312 walEncodeFrame(pWal, p->pgno, nDbsize, pData, aFrame);
46342 walEncodeFrame(pWal, pLast->pgno, nTruncate, pData, aFrame);
46368 rc = walIndexAppend(pWal, iFrame, p->pgno);
46373 rc = walIndexAppend(pWal, iFrame, pLast->pgno);
46891 Pgno pgno; /* Page number for this page */
47156 #define PTRMAP_PAGENO(pBt, pgno) ptrmapPageno(pBt, pgno)
47157 #define PTRMAP_PTROFFSET(pgptrmap, pgno) (5*(pgno-pgptrmap-1))
47158 #define PTRMAP_ISPAGE(pBt, pgno) (PTRMAP_PAGENO((pBt),(pgno))==(pgno))
48040 static int btreeSetHasContent(BtShared *pBt, Pgno pgno){
48043 assert( pgno<=pBt->nPage );
48049 if( rc==SQLITE_OK && pgno<=sqlite3BitvecSize(pBt->pHasContent) ){
48050 rc = sqlite3BitvecSet(pBt->pHasContent, pgno);
48062 static int btreeGetHasContent(BtShared *pBt, Pgno pgno){
48064 return (p && (pgno>sqlite3BitvecSize(p) || sqlite3BitvecTest(p, pgno)));
48253 static Pgno ptrmapPageno(BtShared *pBt, Pgno pgno){
48257 if( pgno<2 ) return 0;
48259 iPtrMap = (pgno-2)/nPagesPerMapPage;
48566 ptrmapPut(pPage->pBt, ovfl, PTRMAP_OVERFLOW1, pPage->pgno, pRC);
48863 assert( pPage->hdrOffset==(pPage->pgno==1 ? 100 : 0) );
48898 assert( pPage->pgno==sqlite3PagerPagenumber(pPage->pDbPage) );
49010 assert( sqlite3PagerPagenumber(pPage->pDbPage)==pPage->pgno );
49039 static MemPage *btreePageFromDbPage(DbPage *pDbPage, Pgno pgno, BtShared *pBt){
49044 pPage->pgno = pgno;
49045 pPage->hdrOffset = pPage->pgno==1 ? 100 : 0;
49062 Pgno pgno, /* Number of the page to fetch */
49070 rc = sqlite3PagerAcquire(pBt->pPager, pgno, (DbPage**)&pDbPage, noContent);
49072 *ppPage = btreePageFromDbPage(pDbPage, pgno, pBt);
49081 static MemPage *btreePageLookup(BtShared *pBt, Pgno pgno){
49084 pDbPage = sqlite3PagerLookup(pBt->pPager, pgno);
49086 return btreePageFromDbPage(pDbPage, pgno, pBt);
49114 Pgno pgno, /* Number of the page to get */
49120 if( pgno>btreePagecount(pBt) ){
49123 rc = btreeGetPage(pBt, pgno, ppPage, 0);
49132 testcase( pgno==0 );
49133 assert( pgno!=0 || rc==SQLITE_CORRUPT );
50195 Pgno pgno = pPage->pgno;
50211 ptrmapPut(pBt, childPgno, PTRMAP_BTREE, pgno, &rc);
50217 ptrmapPut(pBt, childPgno, PTRMAP_BTREE, pgno, &rc);
50307 Pgno iDbPage = pDbPage->pgno;
50323 pDbPage->pgno = iFreePage;
51248 Pgno pgno;
51257 rc = ptrmapGet(pBt, iGuess, &eType, &pgno);
51258 if( rc==SQLITE_OK && eType==PTRMAP_OVERFLOW2 && pgno==ovfl ){
51687 pCur->apPage[pCur->iPage]->pgno
51765 assert( pRoot->pgno==pCur->pgnoRoot );
51775 if( pRoot->pgno!=1 ) return SQLITE_CORRUPT_BKPT;
51793 Pgno pgno;
51801 pgno = get4byte(findCell(pPage, pCur->aiIdx[pCur->iPage]));
51802 rc = moveToChild(pCur, pgno);
51818 Pgno pgno;
51825 pgno = get4byte(&pPage->aData[pPage->hdrOffset+8]);
51827 rc = moveToChild(pCur, pgno);
52458 *pPgno, closest+1, k, pTrunk->pgno, n-1));
52559 assert( !pMemPage || pMemPage->pgno==iPage );
52640 TRACE(("FREE-PAGE: %d leaf on trunk page %d\n",pPage->pgno,pTrunk->pgno));
52661 TRACE(("FREE-PAGE: %d new trunk page replacing %d\n", pPage->pgno, iTrunk));
52673 *pRC = freePage2(pPage->pBt, pPage, pPage->pgno);
53176 ptrmapPut(pBt, pgnoNew, PTRMAP_BTREE, pParent->pgno, &rc);
53203 0, pPage->pgno, &rc);
53240 assert( n==pPage->pgno && e==PTRMAP_OVERFLOW1 );
53245 assert( n==pPage->pgno && e==PTRMAP_BTREE );
53251 assert( n==pPage->pgno && e==PTRMAP_BTREE );
53281 int const iToHdr = ((pTo->pgno==1) ? 100 : 0);
53388 Pgno pgno; /* Temp var to store a page number in */
53395 TRACE(("BALANCE: begin page %d child of %d\n", pPage->pgno, pParent->pgno));
53441 pgno = get4byte(pRight);
53443 rc = getAndInitPage(pBt, pgno, &apOld[i]);
53453 pgno = get4byte(apDiv[i]);
53458 pgno = get4byte(apDiv[i]);
53657 assert( cntNew[0]>0 || (pParent->pgno==1 && pParent->nCell==0) );
53660 apOld[0]->pgno,
53661 nOld>=2 ? apOld[1]->pgno : 0,
53662 nOld>=3 ? apOld[2]->pgno : 0
53668 if( apOld[0]->pgno<=1 ){
53683 rc = allocateBtreePage(pBt, &pNew, &pgno, pgno, 0);
53690 ptrmapPut(pBt, pNew->pgno, PTRMAP_BTREE, pParent->pgno, &rc);
53723 int minV = apNew[i]->pgno;
53726 if( apNew[j]->pgno<(unsigned)minV ){
53728 minV = apNew[j]->pgno;
53739 apNew[0]->pgno, szNew[0],
53740 nNew>=2 ? apNew[1]->pgno : 0, nNew>=2 ? szNew[1] : 0,
53741 nNew>=3 ? apNew[2]->pgno : 0, nNew>=3 ? szNew[2] : 0,
53742 nNew>=4 ? apNew[3]->pgno : 0, nNew>=4 ? szNew[3] : 0,
53743 nNew>=5 ? apNew[4]->pgno : 0, nNew>=5 ? szNew[4] : 0));
53746 put4byte(pRight, apNew[nNew-1]->pgno);
53812 insertCell(pParent, nxDiv, pCell, sz, pTemp, pNew->pgno, &rc);
53927 if( isDivider || pOld->pgno!=pNew->pgno ){
53929 ptrmapPut(pBt, get4byte(apCell[i]), PTRMAP_BTREE, pNew->pgno, &rc);
53940 ptrmapPut(pBt, key, PTRMAP_BTREE, apNew[i]->pgno, &rc);
54008 rc = allocateBtreePage(pBt,&pChild,&pgnoChild,pRoot->pgno,0);
54011 ptrmapPut(pBt, pgnoChild, PTRMAP_BTREE, pRoot->pgno, &rc);
54023 TRACE(("BALANCE: copy root %d into %d\n", pRoot->pgno, pChild->pgno));
54090 && pParent->pgno!=1
54247 pCur->pgnoRoot, nKey, nData, pPage->pgno,
54391 Pgno n = pCur->apPage[iCellDepth+1]->pgno;
54596 Pgno pgno, /* Page number to clear */
54606 if( pgno>btreePagecount(pBt) ){
54610 rc = getAndInitPage(pBt, pgno, &pPage);
55123 int i, rc, depth, d2, pgno, cnt;
55202 pgno = get4byte(pCell);
55205 checkPtrmap(pCheck, pgno, PTRMAP_BTREE, iPage, zContext);
55208 d2 = checkTreePage(pCheck, pgno, zContext, &nMinKey, i==0 ? NULL : &nMaxKey);
55217 pgno = get4byte(&pPage->aData[pPage->hdrOffset+8]);
55222 checkPtrmap(pCheck, pgno, PTRMAP_BTREE, iPage, zContext);
55225 checkTreePage(pCheck, pgno, zContext, NULL, !pPage->nCell ? NULL : &nMaxKey);
63203 int pgno;
65974 int pgno;
65976 rc = sqlite3BtreeCreateTable(u.ax.pCx->pBt, &pgno, BTREE_BLOBKEY);
65978 assert( pgno==MASTER_ROOT+1 );
65979 rc = sqlite3BtreeCursor(u.ax.pCx->pBt, pgno, 1,
67475 int pgno;
67480 u.bt.pgno = 0;
67491 rc = sqlite3BtreeCreateTable(u.bt.pDb->pBt, &u.bt.pgno, u.bt.flags);
67492 pOut->u.i = u.bt.pgno;