Go to the source code of this file.
Defines | |
#define | TRACE(X) |
#define | VVA_ONLY(X) |
#define | restoreCursorPosition(p) |
#define | findCell(P, I) ((P)->aData + ((P)->maskPage & get2byte(&(P)->aData[(P)->cellOffset+2*(I)]))) |
#define | parseCell(pPage, iCell, pInfo) sqlite3BtreeParseCellPtr((pPage), findCell((pPage), (iCell)), (pInfo)) |
#define | assertCellInfo(x) |
#define | getCellInfo(pCur) |
#define | assertParentIndex(x, y, z) |
#define | NN 1 |
#define | NB (NN*2+1) |
Functions | |
int | sqlite3_enable_shared_cache (int enable) |
static int | checkReadLocks (Btree *, Pgno, BtCursor *, i64) |
static int | queryTableLock (Btree *p, Pgno iTab, u8 eLock) |
static int | lockTable (Btree *p, Pgno iTable, u8 eLock) |
static void | unlockAllTables (Btree *p) |
static void | releasePage (MemPage *pPage) |
static void | invalidateOverflowCache (BtCursor *pCur) |
static void | invalidateAllOverflowCache (BtShared *pBt) |
static int | saveCursorPosition (BtCursor *pCur) |
static int | saveAllCursors (BtShared *pBt, Pgno iRoot, BtCursor *pExcept) |
void | sqlite3BtreeClearCursor (BtCursor *pCur) |
int | sqlite3BtreeRestoreCursorPosition (BtCursor *pCur) |
int | sqlite3BtreeCursorHasMoved (BtCursor *pCur, int *pHasMoved) |
static Pgno | ptrmapPageno (BtShared *pBt, Pgno pgno) |
static int | ptrmapPut (BtShared *pBt, Pgno key, u8 eType, Pgno parent) |
static int | ptrmapGet (BtShared *pBt, Pgno key, u8 *pEType, Pgno *pPgno) |
static u8 * | findOverflowCell (MemPage *pPage, int iCell) |
void | sqlite3BtreeParseCellPtr (MemPage *pPage, u8 *pCell, CellInfo *pInfo) |
void | sqlite3BtreeParseCell (MemPage *pPage, int iCell, CellInfo *pInfo) |
static u16 | cellSizePtr (MemPage *pPage, u8 *pCell) |
static int | ptrmapPutOvflPtr (MemPage *pPage, u8 *pCell) |
static int | ptrmapPutOvfl (MemPage *pPage, int iCell) |
static int | defragmentPage (MemPage *pPage) |
static int | allocateSpace (MemPage *pPage, int nByte) |
static void | freeSpace (MemPage *pPage, int start, int size) |
static int | decodeFlags (MemPage *pPage, int flagByte) |
int | sqlite3BtreeInitPage (MemPage *pPage) |
static void | zeroPage (MemPage *pPage, int flags) |
static MemPage * | btreePageFromDbPage (DbPage *pDbPage, Pgno pgno, BtShared *pBt) |
int | sqlite3BtreeGetPage (BtShared *pBt, Pgno pgno, MemPage **ppPage, int noContent) |
static int | pagerPagecount (Pager *pPager) |
static int | getAndInitPage (BtShared *pBt, Pgno pgno, MemPage **ppPage) |
static void | pageReinit (DbPage *pData) |
static int | sqlite3BtreeInvokeBusyHandler (void *pArg, int n) |
int | sqlite3BtreeOpen (const char *zFilename, sqlite3 *db, Btree **ppBtree, int flags, int vfsFlags) |
static int | removeFromSharingList (BtShared *pBt) |
static void | allocateTempSpace (BtShared *pBt) |
static void | freeTempSpace (BtShared *pBt) |
int | sqlite3BtreeClose (Btree *p) |
int | sqlite3BtreeSetCacheSize (Btree *p, int mxPage) |
int | sqlite3BtreeSetSafetyLevel (Btree *p, int level, int fullSync) |
int | sqlite3BtreeSyncDisabled (Btree *p) |
int | sqlite3BtreeSetPageSize (Btree *p, int pageSize, int nReserve) |
int | sqlite3BtreeGetPageSize (Btree *p) |
int | sqlite3BtreeGetReserve (Btree *p) |
int | sqlite3BtreeMaxPageCount (Btree *p, int mxPage) |
int | sqlite3BtreeSetAutoVacuum (Btree *p, int autoVacuum) |
int | sqlite3BtreeGetAutoVacuum (Btree *p) |
static int | lockBtree (BtShared *pBt) |
static int | lockBtreeWithRetry (Btree *pRef) |
static void | unlockBtreeIfUnused (BtShared *pBt) |
static int | newDatabase (BtShared *pBt) |
int | sqlite3BtreeBeginTrans (Btree *p, int wrflag) |
static int | setChildPtrmaps (MemPage *pPage) |
static int | modifyPagePointer (MemPage *pPage, Pgno iFrom, Pgno iTo, u8 eType) |
static int | relocatePage (BtShared *pBt, MemPage *pDbPage, u8 eType, Pgno iPtrPage, Pgno iFreePage, int isCommit) |
static int | allocateBtreePage (BtShared *, MemPage **, Pgno *, Pgno, u8) |
static int | incrVacuumStep (BtShared *pBt, Pgno nFin) |
int | sqlite3BtreeIncrVacuum (Btree *p) |
static int | autoVacuumCommit (BtShared *pBt, Pgno *pnTrunc) |
int | sqlite3BtreeCommitPhaseOne (Btree *p, const char *zMaster) |
int | sqlite3BtreeCommitPhaseTwo (Btree *p) |
int | sqlite3BtreeCommit (Btree *p) |
void | sqlite3BtreeTripAllCursors (Btree *pBtree, int errCode) |
int | sqlite3BtreeRollback (Btree *p) |
int | sqlite3BtreeBeginStmt (Btree *p) |
int | sqlite3BtreeCommitStmt (Btree *p) |
int | sqlite3BtreeRollbackStmt (Btree *p) |
static int | btreeCursor (Btree *p, int iTable, int wrFlag, struct KeyInfo *pKeyInfo, BtCursor *pCur) |
int | sqlite3BtreeCursor (Btree *p, int iTable, int wrFlag, struct KeyInfo *pKeyInfo, BtCursor *pCur) |
int | sqlite3BtreeCursorSize () |
int | sqlite3BtreeCloseCursor (BtCursor *pCur) |
void | sqlite3BtreeGetTempCursor (BtCursor *pCur, BtCursor *pTempCur) |
void | sqlite3BtreeReleaseTempCursor (BtCursor *pCur) |
int | sqlite3BtreeKeySize (BtCursor *pCur, i64 *pSize) |
int | sqlite3BtreeDataSize (BtCursor *pCur, u32 *pSize) |
static int | getOverflowPage (BtShared *pBt, Pgno ovfl, MemPage **ppPage, Pgno *pPgnoNext) |
static int | copyPayload (void *pPayload, void *pBuf, int nByte, int eOp, DbPage *pDbPage) |
static int | accessPayload (BtCursor *pCur, int offset, int amt, unsigned char *pBuf, int skipKey, int eOp) |
int | sqlite3BtreeKey (BtCursor *pCur, u32 offset, u32 amt, void *pBuf) |
int | sqlite3BtreeData (BtCursor *pCur, u32 offset, u32 amt, void *pBuf) |
static const unsigned char * | fetchPayload (BtCursor *pCur, int *pAmt, int skipKey) |
const void * | sqlite3BtreeKeyFetch (BtCursor *pCur, int *pAmt) |
const void * | sqlite3BtreeDataFetch (BtCursor *pCur, int *pAmt) |
static int | moveToChild (BtCursor *pCur, u32 newPgno) |
void | sqlite3BtreeMoveToParent (BtCursor *pCur) |
static int | moveToRoot (BtCursor *pCur) |
static int | moveToLeftmost (BtCursor *pCur) |
static int | moveToRightmost (BtCursor *pCur) |
int | sqlite3BtreeFirst (BtCursor *pCur, int *pRes) |
int | sqlite3BtreeLast (BtCursor *pCur, int *pRes) |
int | sqlite3BtreeMovetoUnpacked (BtCursor *pCur, UnpackedRecord *pIdxKey, i64 intKey, int biasRight, int *pRes) |
int | sqlite3BtreeMoveto (BtCursor *pCur, const void *pKey, i64 nKey, int bias, int *pRes) |
int | sqlite3BtreeEof (BtCursor *pCur) |
sqlite3 * | sqlite3BtreeCursorDb (const BtCursor *pCur) |
int | sqlite3BtreeNext (BtCursor *pCur, int *pRes) |
int | sqlite3BtreePrevious (BtCursor *pCur, int *pRes) |
static int | freePage (MemPage *pPage) |
static int | clearCell (MemPage *pPage, unsigned char *pCell) |
static int | fillInCell (MemPage *pPage, unsigned char *pCell, const void *pKey, i64 nKey, const void *pData, int nData, int nZero, int *pnSize) |
static int | dropCell (MemPage *pPage, int idx, int sz) |
static int | insertCell (MemPage *pPage, int i, u8 *pCell, int sz, u8 *pTemp, u8 nSkip) |
static void | assemblePage (MemPage *pPage, int nCell, u8 **apCell, u16 *aSize) |
static int | balance (BtCursor *, int) |
static int | balance_quick (BtCursor *pCur) |
static int | balance_nonroot (BtCursor *pCur) |
static int | balance_shallower (BtCursor *pCur) |
static int | balance_deeper (BtCursor *pCur) |
int | sqlite3BtreeInsert (BtCursor *pCur, const void *pKey, i64 nKey, const void *pData, int nData, int nZero, int appendBias) |
int | sqlite3BtreeDelete (BtCursor *pCur) |
static int | btreeCreateTable (Btree *p, int *piTable, int flags) |
int | sqlite3BtreeCreateTable (Btree *p, int *piTable, int flags) |
static int | clearDatabasePage (BtShared *pBt, Pgno pgno, MemPage *pParent, int freePageFlag, int *pnChange) |
int | sqlite3BtreeClearTable (Btree *p, int iTable, int *pnChange) |
static int | btreeDropTable (Btree *p, int iTable, int *piMoved) |
int | sqlite3BtreeDropTable (Btree *p, int iTable, int *piMoved) |
int | sqlite3BtreeGetMeta (Btree *p, int idx, u32 *pMeta) |
int | sqlite3BtreeUpdateMeta (Btree *p, int idx, u32 iMeta) |
int | sqlite3BtreeFlags (BtCursor *pCur) |
Pager * | sqlite3BtreePager (Btree *p) |
static void | checkAppendMsg (IntegrityCk *pCheck, char *zMsg1, const char *zFormat,...) |
static int | checkRef (IntegrityCk *pCheck, int iPage, char *zContext) |
static void | checkPtrmap (IntegrityCk *pCheck, Pgno iChild, u8 eType, Pgno iParent, char *zContext) |
static void | checkList (IntegrityCk *pCheck, int isFreeList, int iPage, int N, char *zContext) |
static int | checkTreePage (IntegrityCk *pCheck, int iPage, MemPage *pParent, char *zParentContext) |
char * | sqlite3BtreeIntegrityCheck (Btree *p, int *aRoot, int nRoot, int mxErr, int *pnErr) |
const char * | sqlite3BtreeGetFilename (Btree *p) |
const char * | sqlite3BtreeGetDirname (Btree *p) |
const char * | sqlite3BtreeGetJournalname (Btree *p) |
static int | btreeCopyFile (Btree *pTo, Btree *pFrom) |
int | sqlite3BtreeCopyFile (Btree *pTo, Btree *pFrom) |
int | sqlite3BtreeIsInTrans (Btree *p) |
int | sqlite3BtreeIsInStmt (Btree *p) |
int | sqlite3BtreeIsInReadTrans (Btree *p) |
void * | sqlite3BtreeSchema (Btree *p, int nBytes, void(*xFree)(void *)) |
int | sqlite3BtreeSchemaLocked (Btree *p) |
int | sqlite3BtreeLockTable (Btree *p, int iTab, u8 isWriteLock) |
int | sqlite3BtreePutData (BtCursor *pCsr, u32 offset, u32 amt, void *z) |
void | sqlite3BtreeCacheOverflow (BtCursor *pCur) |
Variables | |
static const char | zMagicHeader [] = SQLITE_FILE_HEADER |
static BtShared *SQLITE_WSD | sqlite3SharedCacheList = 0 |
#define assertParentIndex | ( | x, | |||
y, | |||||
z | ) |
Definition at line 3493 of file btree.c.
Referenced by balance_nonroot(), and sqlite3BtreeMoveToParent().
#define findCell | ( | P, | |||
I | ) | ((P)->aData + ((P)->maskPage & get2byte(&(P)->aData[(P)->cellOffset+2*(I)]))) |
Definition at line 538 of file btree.c.
Referenced by balance_nonroot(), balance_quick(), balance_shallower(), checkTreePage(), clearDatabasePage(), findOverflowCell(), modifyPagePointer(), moveToLeftmost(), setChildPtrmaps(), sqlite3BtreeDelete(), sqlite3BtreeInsert(), sqlite3BtreeMovetoUnpacked(), and sqlite3BtreePrevious().
#define getCellInfo | ( | pCur | ) |
if( pCur->info.nSize==0 ){ \ int iPage = pCur->iPage; \ sqlite3BtreeParseCell(pCur->apPage[iPage],pCur->aiIdx[iPage],&pCur->info); \ pCur->validNKey = 1; \ }else{ \ assertCellInfo(pCur); \ }
Definition at line 2964 of file btree.c.
Referenced by accessPayload(), fetchPayload(), sqlite3BtreeDataSize(), sqlite3BtreeKeySize(), and sqlite3BtreeLast().
#define NB (NN*2+1) |
Definition at line 4758 of file btree.c.
Referenced by balance_nonroot().
#define NN 1 |
Definition at line 4757 of file btree.c.
Referenced by balance_nonroot().
#define parseCell | ( | pPage, | |||
iCell, | |||||
pInfo | ) | sqlite3BtreeParseCellPtr((pPage), findCell((pPage), (iCell)), (pInfo)) |
Definition at line 639 of file btree.c.
Referenced by sqlite3BtreeParseCell().
#define restoreCursorPosition | ( | p | ) |
(p->eState>=CURSOR_REQUIRESEEK ? \ sqlite3BtreeRestoreCursorPosition(p) : \ SQLITE_OK)
Definition at line 402 of file btree.c.
Referenced by sqlite3BtreeCursorHasMoved(), sqlite3BtreeData(), sqlite3BtreeDataSize(), sqlite3BtreeDelete(), sqlite3BtreeFlags(), sqlite3BtreeKey(), sqlite3BtreeKeySize(), sqlite3BtreeNext(), sqlite3BtreePrevious(), and sqlite3BtreePutData().
#define TRACE | ( | X | ) |
Definition at line 34 of file btree.c.
Referenced by allocateBtreePage(), balance_deeper(), balance_nonroot(), balance_shallower(), constructVtab(), freePage(), fulltext_vtab_destroy(), fulltextBegin(), fulltextBestIndex(), fulltextClose(), fulltextCommit(), fulltextCreate(), fulltextDestroy(), fulltextDisconnect(), fulltextFilter(), fulltextNext(), fulltextOpen(), fulltextRollback(), fulltextSync(), fulltextUpdate(), ptrmapPut(), relocatePage(), sql_exec(), sql_prepare(), sqlite3BtreeDelete(), and sqlite3BtreeInsert().
#define VVA_ONLY | ( | X | ) |
Definition at line 48 of file btree.c.
Referenced by autoVacuumCommit(), balance_deeper(), balance_nonroot(), balance_shallower(), and sqlite3BtreeDelete().
static int accessPayload | ( | BtCursor * | pCur, | |
int | offset, | |||
int | amt, | |||
unsigned char * | pBuf, | |||
int | skipKey, | |||
int | eOp | |||
) | [static] |
Definition at line 3171 of file btree.c.
References BtCursor::aiIdx, BtCursor::aOverflow, BtCursor::apPage, copyPayload(), CURSOR_VALID, BtCursor::eState, get4byte, getCellInfo, getOverflowPage(), BtCursor::info, MemPage::intKey, BtCursor::iPage, BtCursor::isIncrblobHandle, MemPage::nCell, CellInfo::nData, CellInfo::nHeader, CellInfo::nKey, CellInfo::nLocal, CellInfo::nPayload, BtCursor::pBt, CellInfo::pCell, MemPage::pDbPage, BtShared::pPager, sqlite3MallocZero(), sqlite3PagerGet, sqlite3PagerGetData(), sqlite3PagerUnref(), SQLITE_CORRUPT_BKPT, SQLITE_NOMEM, SQLITE_OK, and BtShared::usableSize.
Referenced by sqlite3BtreeData(), sqlite3BtreeKey(), and sqlite3BtreePutData().
static int allocateBtreePage | ( | BtShared * | pBt, | |
MemPage ** | ppPage, | |||
Pgno * | pPgno, | |||
Pgno | nearby, | |||
u8 | exact | |||
) | [static] |
Definition at line 4050 of file btree.c.
References MemPage::aData, BtShared::autoVacuum, get4byte, BtShared::mutex, BtShared::nTrunc, pagerPagecount(), MemPage::pDbPage, PENDING_BYTE_PAGE, MemPage::pgno, BtShared::pPage1, BtShared::pPager, PTRMAP_FREEPAGE, PTRMAP_ISPAGE, ptrmapGet(), put4byte, releasePage(), sqlite3_mutex_held, sqlite3BtreeGetPage(), sqlite3PagerDontRollback(), sqlite3PagerPageRefcount(), sqlite3PagerWrite(), SQLITE_CORRUPT_BKPT, SQLITE_OK, TRACE, and BtShared::usableSize.
Referenced by balance_deeper(), balance_nonroot(), balance_quick(), btreeCreateTable(), fillInCell(), and incrVacuumStep().
static int allocateSpace | ( | MemPage * | pPage, | |
int | nByte | |||
) | [static] |
Definition at line 773 of file btree.c.
References MemPage::aData, MemPage::cellOffset, defragmentPage(), get2byte, MemPage::hdrOffset, BtShared::mutex, MemPage::nFree, MemPage::nOverflow, MemPage::pBt, MemPage::pDbPage, put2byte, and sqlite3_mutex_held.
Referenced by assemblePage(), and insertCell().
static void allocateTempSpace | ( | BtShared * | pBt | ) | [static] |
Definition at line 1475 of file btree.c.
References BtShared::pageSize, BtShared::pTmpSpace, and sqlite3PageMalloc().
Referenced by sqlite3BtreeDelete(), and sqlite3BtreeInsert().
Definition at line 4704 of file btree.c.
References MemPage::aData, allocateSpace(), MemPage::cellOffset, MemPage::hdrOffset, BtShared::mutex, MemPage::nCell, MemPage::nFree, MemPage::nOverflow, MemPage::pBt, put2byte, sqlite3_mutex_held, and BtShared::usableSize.
Referenced by balance_nonroot(), balance_quick(), and balance_shallower().
Definition at line 2378 of file btree.c.
References MemPage::aData, BtShared::autoVacuum, get4byte, BtShared::incrVacuum, incrVacuumStep(), invalidateAllOverflowCache(), BtShared::mutex, BtShared::nTrunc, pagerPagecount(), BtShared::pageSize, MemPage::pDbPage, PENDING_BYTE_PAGE, BtShared::pPage1, BtShared::pPager, PTRMAP_ISPAGE, PTRMAP_PAGENO, put4byte, sqlite3_mutex_held, sqlite3PagerRefcount(), sqlite3PagerRollback(), sqlite3PagerWrite(), SQLITE_CORRUPT_BKPT, SQLITE_DONE, SQLITE_OK, and VVA_ONLY.
Referenced by sqlite3BtreeCommitPhaseOne().
static int balance | ( | BtCursor * | pCur, | |
int | isInsert | |||
) | [static] |
Definition at line 5660 of file btree.c.
References BtCursor::apPage, balance_deeper(), balance_nonroot(), balance_shallower(), BtCursor::iPage, BtShared::mutex, MemPage::nCell, MemPage::nFree, MemPage::nOverflow, MemPage::pBt, MemPage::pDbPage, sqlite3_mutex_held, sqlite3PagerWrite(), SQLITE_OK, and BtShared::usableSize.
Referenced by balance_nonroot(), balance_quick(), sqlite3BtreeDelete(), and sqlite3BtreeInsert().
static int balance_deeper | ( | BtCursor * | pCur | ) | [static] |
Definition at line 5587 of file btree.c.
References MemPage::aData, BtCursor::aiIdx, allocateBtreePage(), MemPage::aOvfl, BtCursor::apPage, balance_nonroot(), MemPage::cellOffset, get2byte, MemPage::hdrOffset, BtCursor::iPage, ISAUTOVACUUM, BtShared::mutex, MemPage::nCell, MemPage::nFree, MemPage::nOverflow, MemPage::pBt, MemPage::pDbPage, MemPage::pgno, PTF_LEAF, PTRMAP_BTREE, ptrmapPut(), put4byte, releasePage(), setChildPtrmaps(), sqlite3_mutex_held, sqlite3BtreeInitPage(), SQLITE_OK, TRACE, BtShared::usableSize, VVA_ONLY, and zeroPage().
Referenced by balance().
static int balance_nonroot | ( | BtCursor * | pCur | ) | [static] |
Definition at line 4904 of file btree.c.
References MemPage::aData, BtCursor::aiIdx, allocateBtreePage(), MemPage::aOvfl, BtCursor::apPage, assemblePage(), assertParentIndex, balance(), balance_quick(), cellSizePtr(), d(), dropCell(), fillInCell(), findCell, findOverflowCell(), freePage(), get4byte, getAndInitPage(), MemPage::hasData, MemPage::hdrOffset, MemPage::_OvflCell::idx, insertCell(), MemPage::intKey, BtCursor::iPage, ISAUTOVACUUM, MemPage::isInit, MemPage::leaf, BtShared::mutex, NB, MemPage::nCell, CellInfo::nKey, NN, MemPage::nOverflow, BtShared::pageSize, MemPage::pBt, MemPage::_OvflCell::pCell, MemPage::pDbPage, MemPage::pgno, PTF_LEAF, PTRMAP_BTREE, ptrmapPut(), ptrmapPutOvfl(), put4byte, releasePage(), ROUND8, sqlite3_mutex_held, sqlite3BtreeParseCellPtr(), sqlite3PageFree(), sqlite3PageMalloc(), sqlite3PagerWrite(), sqlite3ScratchFree(), sqlite3ScratchMalloc(), SQLITE_NOMEM, SQLITE_OK, TRACE, BtShared::usableSize, VVA_ONLY, and zeroPage().
Referenced by balance(), and balance_deeper().
static int balance_quick | ( | BtCursor * | pCur | ) | [static] |
Definition at line 4781 of file btree.c.
References MemPage::aData, allocateBtreePage(), MemPage::aOvfl, BtCursor::apPage, assemblePage(), balance(), cellSizePtr(), fillInCell(), findCell, findOverflowCell(), MemPage::hdrOffset, insertCell(), BtCursor::iPage, ISAUTOVACUUM, MemPage::isInit, BtShared::mutex, MemPage::nCell, CellInfo::nKey, MemPage::nOverflow, MemPage::pBt, MemPage::_OvflCell::pCell, MemPage::pDbPage, MemPage::pgno, PTRMAP_BTREE, ptrmapPut(), ptrmapPutOvfl(), put4byte, releasePage(), sqlite3_mutex_held, sqlite3BtreeInitPage(), sqlite3BtreeParseCellPtr(), SQLITE_OK, and zeroPage().
Referenced by balance_nonroot().
static int balance_shallower | ( | BtCursor * | pCur | ) | [static] |
Definition at line 5489 of file btree.c.
References MemPage::aData, BtCursor::apPage, assemblePage(), cellSizePtr(), findCell, freePage(), get4byte, MemPage::hdrOffset, BtCursor::iPage, ISAUTOVACUUM, MemPage::isInit, MemPage::leaf, BtShared::mutex, MX_CELL, MemPage::nCell, MemPage::nFree, MemPage::nOverflow, pagerPagecount(), MemPage::pBt, MemPage::pgno, BtShared::pPager, put4byte, releasePage(), setChildPtrmaps(), sqlite3_free(), sqlite3_mutex_held, sqlite3BtreeGetPage(), sqlite3BtreeInitPage(), sqlite3Malloc(), SQLITE_NOMEM, SQLITE_OK, TRACE, BtShared::usableSize, VVA_ONLY, and zeroPage().
Referenced by balance().
Definition at line 7057 of file btree.c.
References Btree::db, BtShared::db, Btree::inTrans, MemPage::isInit, pagerPagecount(), BtShared::pageSize, BtShared::pageSizeFixed, Btree::pBt, BtShared::pCursor, PENDING_BYTE_PAGE, BtShared::pPager, sqlite3BtreeRollback(), sqlite3OsTruncate(), sqlite3OsWrite(), sqlite3PagerCommitPhaseOne(), sqlite3PagerDontWrite(), sqlite3PagerFile(), sqlite3PagerGet, sqlite3PagerGetData(), sqlite3PagerGetExtra(), sqlite3PagerSync(), sqlite3PagerTruncate(), sqlite3PagerUnref(), sqlite3PagerWrite(), SQLITE_BUSY, SQLITE_ERROR, SQLITE_OK, and TRANS_WRITE.
Referenced by sqlite3BtreeCopyFile().
static int btreeCreateTable | ( | Btree * | p, | |
int * | piTable, | |||
int | flags | |||
) | [static] |
Definition at line 6066 of file btree.c.
References allocateBtreePage(), BtShared::autoVacuum, BtShared::inTransaction, invalidateAllOverflowCache(), Btree::pBt, MemPage::pDbPage, PENDING_BYTE_PAGE, PTF_LEAF, PTRMAP_FREEPAGE, PTRMAP_PAGENO, PTRMAP_ROOTPAGE, ptrmapGet(), ptrmapPut(), BtShared::readOnly, releasePage(), relocatePage(), sqlite3BtreeGetMeta(), sqlite3BtreeGetPage(), sqlite3BtreeUpdateMeta(), sqlite3PagerUnref(), sqlite3PagerWrite(), SQLITE_ERROR, SQLITE_OK, SQLITE_READONLY, TRANS_WRITE, and zeroPage().
Referenced by sqlite3BtreeCreateTable().
static int btreeCursor | ( | Btree * | p, | |
int | iTable, | |||
int | wrFlag, | |||
struct KeyInfo * | pKeyInfo, | |||
BtCursor * | pCur | |||
) | [static] |
Definition at line 2786 of file btree.c.
References BtCursor::apPage, checkReadLocks(), CURSOR_INVALID, BtCursor::eState, getAndInitPage(), lockBtreeWithRetry(), pagerPagecount(), BtCursor::pBt, Btree::pBt, BtCursor::pBtree, BtShared::pCursor, BtCursor::pgnoRoot, BtCursor::pKeyInfo, BtCursor::pNext, BtShared::pPage1, BtShared::pPager, BtCursor::pPrev, BtShared::readOnly, releasePage(), SQLITE_EMPTY, SQLITE_LOCKED, SQLITE_OK, SQLITE_READONLY, unlockBtreeIfUnused(), and BtCursor::wrFlag.
Referenced by sqlite3BtreeCursor().
static int btreeDropTable | ( | Btree * | p, | |
int | iTable, | |||
int * | piMoved | |||
) | [static] |
Definition at line 6307 of file btree.c.
References BtShared::autoVacuum, freePage(), Btree::inTrans, Btree::pBt, BtShared::pCursor, PENDING_BYTE_PAGE, PTF_INTKEY, PTF_LEAF, PTRMAP_PAGENO, PTRMAP_ROOTPAGE, BtShared::readOnly, releasePage(), relocatePage(), sqlite3BtreeClearTable(), sqlite3BtreeGetMeta(), sqlite3BtreeGetPage(), sqlite3BtreeUpdateMeta(), SQLITE_ERROR, SQLITE_LOCKED, SQLITE_OK, SQLITE_READONLY, TRANS_WRITE, and zeroPage().
Referenced by sqlite3BtreeDropTable().
Definition at line 1065 of file btree.c.
References MemPage::aData, MemPage::hdrOffset, MemPage::pBt, MemPage::pDbPage, MemPage::pgno, sqlite3PagerGetData(), and sqlite3PagerGetExtra().
Referenced by getAndInitPage(), and sqlite3BtreeGetPage().
Definition at line 662 of file btree.c.
References CellInfo::nSize, and sqlite3BtreeParseCellPtr().
Referenced by balance_nonroot(), balance_quick(), balance_shallower(), checkTreePage(), defragmentPage(), insertCell(), sqlite3BtreeDelete(), and sqlite3BtreeInsert().
static void checkAppendMsg | ( | IntegrityCk * | pCheck, | |
char * | zMsg1, | |||
const char * | zFormat, | |||
... | ||||
) | [static] |
Definition at line 6556 of file btree.c.
References IntegrityCk::errMsg, IntegrityCk::mallocFailed, StrAccum::mallocFailed, IntegrityCk::mxErr, StrAccum::nChar, IntegrityCk::nErr, sqlite3StrAccumAppend(), and sqlite3VXPrintf().
Referenced by checkList(), checkPtrmap(), checkRef(), checkTreePage(), and sqlite3BtreeIntegrityCheck().
static void checkList | ( | IntegrityCk * | pCheck, | |
int | isFreeList, | |||
int | iPage, | |||
int | N, | |||
char * | zContext | |||
) | [static] |
Definition at line 6638 of file btree.c.
References BtShared::autoVacuum, checkAppendMsg(), checkPtrmap(), checkRef(), get4byte, IntegrityCk::mxErr, IntegrityCk::pBt, IntegrityCk::pPager, PTRMAP_FREEPAGE, PTRMAP_OVERFLOW2, sqlite3PagerGet, sqlite3PagerGetData(), sqlite3PagerUnref(), and BtShared::usableSize.
Referenced by checkTreePage(), and sqlite3BtreeIntegrityCheck().
static void checkPtrmap | ( | IntegrityCk * | pCheck, | |
Pgno | iChild, | |||
u8 | eType, | |||
Pgno | iParent, | |||
char * | zContext | |||
) | [static] |
Definition at line 6609 of file btree.c.
References checkAppendMsg(), IntegrityCk::pBt, ptrmapGet(), and SQLITE_OK.
Referenced by checkList(), checkTreePage(), and sqlite3BtreeIntegrityCheck().
Definition at line 5714 of file btree.c.
References CURSOR_INVALID, CURSOR_VALID, Btree::db, db, BtCursor::eState, sqlite3::flags, BtCursor::info, BtCursor::isIncrblobHandle, CellInfo::nKey, Btree::pBt, BtCursor::pBtree, BtShared::pCursor, BtCursor::pgnoRoot, BtCursor::pNext, SQLITE_LOCKED, SQLITE_OK, SQLITE_ReadUncommitted, and BtCursor::wrFlag.
Referenced by btreeCursor(), sqlite3BtreeClearTable(), sqlite3BtreeDelete(), sqlite3BtreeInsert(), and sqlite3BtreePutData().
static int checkRef | ( | IntegrityCk * | pCheck, | |
int | iPage, | |||
char * | zContext | |||
) | [static] |
Definition at line 6590 of file btree.c.
References IntegrityCk::anRef, checkAppendMsg(), and IntegrityCk::nPage.
Referenced by checkList(), and checkTreePage().
static int checkTreePage | ( | IntegrityCk * | pCheck, | |
int | iPage, | |||
MemPage * | pParent, | |||
char * | zParentContext | |||
) | [static] |
Definition at line 6724 of file btree.c.
References MemPage::aData, BtShared::autoVacuum, cellSizePtr(), checkAppendMsg(), checkList(), checkPtrmap(), checkRef(), findCell, get2byte, get4byte, MemPage::hdrOffset, MemPage::intKey, CellInfo::iOverflow, MemPage::leaf, IntegrityCk::mallocFailed, IntegrityCk::mxErr, MemPage::nCell, CellInfo::nData, CellInfo::nKey, CellInfo::nLocal, CellInfo::nPayload, BtShared::pageSize, IntegrityCk::pBt, PTRMAP_BTREE, PTRMAP_OVERFLOW1, releasePage(), sqlite3_snprintf(), sqlite3BtreeGetPage(), sqlite3BtreeInitPage(), sqlite3BtreeParseCellPtr(), sqlite3PageFree(), sqlite3PageMalloc(), and BtShared::usableSize.
Referenced by sqlite3BtreeIntegrityCheck().
static int clearCell | ( | MemPage * | pPage, | |
unsigned char * | pCell | |||
) | [static] |
Definition at line 4392 of file btree.c.
References freePage(), get4byte, getOverflowPage(), CellInfo::iOverflow, BtShared::mutex, CellInfo::nLocal, CellInfo::nPayload, pagerPagecount(), MemPage::pBt, MemPage::pDbPage, BtShared::pPager, sqlite3_mutex_held, sqlite3BtreeParseCellPtr(), sqlite3PagerUnref(), SQLITE_CORRUPT_BKPT, SQLITE_OK, and BtShared::usableSize.
Referenced by clearDatabasePage(), sqlite3BtreeDelete(), and sqlite3BtreeInsert().
static int clearDatabasePage | ( | BtShared * | pBt, | |
Pgno | pgno, | |||
MemPage * | pParent, | |||
int | freePageFlag, | |||
int * | pnChange | |||
) | [static] |
Definition at line 6210 of file btree.c.
References MemPage::aData, clearCell(), findCell, freePage(), get4byte, getAndInitPage(), MemPage::intKey, MemPage::leaf, BtShared::mutex, MemPage::nCell, pagerPagecount(), MemPage::pDbPage, BtShared::pPager, PTF_LEAF, releasePage(), sqlite3_mutex_held, sqlite3PagerWrite(), SQLITE_CORRUPT_BKPT, and zeroPage().
Referenced by sqlite3BtreeClearTable().
static int copyPayload | ( | void * | pPayload, | |
void * | pBuf, | |||
int | nByte, | |||
int | eOp, | |||
DbPage * | pDbPage | |||
) | [static] |
Definition at line 3120 of file btree.c.
References sqlite3PagerWrite(), and SQLITE_OK.
Referenced by accessPayload().
static int decodeFlags | ( | MemPage * | pPage, | |
int | flagByte | |||
) | [static] |
Definition at line 910 of file btree.c.
References MemPage::childPtrSize, MemPage::hasData, MemPage::hdrOffset, MemPage::intKey, MemPage::leaf, BtShared::maxLeaf, BtShared::maxLocal, MemPage::maxLocal, BtShared::minLeaf, BtShared::minLocal, MemPage::minLocal, BtShared::mutex, MemPage::pBt, MemPage::pgno, PTF_INTKEY, PTF_LEAF, PTF_LEAFDATA, PTF_ZERODATA, sqlite3_mutex_held, SQLITE_CORRUPT_BKPT, and SQLITE_OK.
Referenced by sqlite3BtreeInitPage(), and zeroPage().
static int defragmentPage | ( | MemPage * | pPage | ) | [static] |
Definition at line 705 of file btree.c.
References MemPage::aData, MemPage::cellOffset, cellSizePtr(), get2byte, MemPage::hdrOffset, BtShared::mutex, MemPage::nCell, MemPage::nFree, MemPage::nOverflow, MemPage::pBt, MemPage::pDbPage, BtShared::pPager, put2byte, sqlite3_mutex_held, sqlite3PagerTempSpace(), SQLITE_CORRUPT_BKPT, SQLITE_MAX_PAGE_SIZE, SQLITE_OK, and BtShared::usableSize.
Referenced by allocateSpace(), and insertCell().
static int dropCell | ( | MemPage * | pPage, | |
int | idx, | |||
int | sz | |||
) | [static] |
Definition at line 4570 of file btree.c.
References MemPage::aData, MemPage::cellOffset, freeSpace(), get2byte, MemPage::hdrOffset, BtShared::mutex, MemPage::nCell, MemPage::nFree, MemPage::pBt, MemPage::pDbPage, put2byte, sqlite3_mutex_held, SQLITE_CORRUPT_BKPT, SQLITE_OK, and BtShared::usableSize.
Referenced by balance_nonroot(), sqlite3BtreeDelete(), and sqlite3BtreeInsert().
static const unsigned char* fetchPayload | ( | BtCursor * | pCur, | |
int * | pAmt, | |||
int | skipKey | |||
) | [static] |
Definition at line 3379 of file btree.c.
References BtCursor::aiIdx, BtCursor::apPage, CURSOR_VALID, BtCursor::eState, getCellInfo, BtCursor::info, MemPage::intKey, BtCursor::iPage, MemPage::nCell, CellInfo::nHeader, CellInfo::nKey, CellInfo::nLocal, and CellInfo::pCell.
Referenced by sqlite3BtreeDataFetch(), sqlite3BtreeKeyFetch(), and sqlite3BtreeMovetoUnpacked().
static int fillInCell | ( | MemPage * | pPage, | |
unsigned char * | pCell, | |||
const void * | pKey, | |||
i64 | nKey, | |||
const void * | pData, | |||
int | nData, | |||
int | nZero, | |||
int * | pnSize | |||
) | [static] |
Definition at line 4436 of file btree.c.
References MemPage::aData, allocateBtreePage(), BtShared::autoVacuum, MemPage::hasData, MemPage::intKey, CellInfo::iOverflow, MemPage::leaf, BtShared::mutex, CellInfo::nData, CellInfo::nHeader, CellInfo::nKey, CellInfo::nLocal, CellInfo::nSize, MemPage::pBt, PENDING_BYTE_PAGE, PTRMAP_ISPAGE, PTRMAP_OVERFLOW1, PTRMAP_OVERFLOW2, ptrmapPut(), put4byte, putVarint, releasePage(), sqlite3_mutex_held, sqlite3BtreeParseCellPtr(), SQLITE_OK, and BtShared::usableSize.
Referenced by balance_nonroot(), balance_quick(), and sqlite3BtreeInsert().
Definition at line 545 of file btree.c.
References MemPage::aOvfl, findCell, MemPage::_OvflCell::idx, BtShared::mutex, MemPage::nOverflow, MemPage::pBt, and sqlite3_mutex_held.
Referenced by balance_nonroot(), balance_quick(), ptrmapPutOvfl(), and sqlite3BtreeDelete().
static int freePage | ( | MemPage * | pPage | ) | [static] |
Definition at line 4300 of file btree.c.
References MemPage::aData, get4byte, ISAUTOVACUUM, MemPage::isInit, BtShared::mutex, BtShared::pageSize, MemPage::pBt, MemPage::pDbPage, MemPage::pgno, BtShared::pPage1, PTRMAP_FREEPAGE, ptrmapPut(), put4byte, releasePage(), sqlite3_mutex_held, sqlite3BtreeGetPage(), sqlite3PagerDontWrite(), sqlite3PagerWrite(), SQLITE_CORRUPT, SQLITE_OK, TRACE, and BtShared::usableSize.
Referenced by balance_nonroot(), balance_shallower(), btreeDropTable(), clearCell(), and clearDatabasePage().
static void freeSpace | ( | MemPage * | pPage, | |
int | start, | |||
int | size | |||
) | [static] |
Definition at line 837 of file btree.c.
References MemPage::aData, get2byte, MemPage::hdrOffset, MemPage::leaf, BtShared::mutex, MemPage::nFree, MemPage::pBt, MemPage::pDbPage, put2byte, sqlite3_mutex_held, and BtShared::usableSize.
Referenced by dropCell().
static void freeTempSpace | ( | BtShared * | pBt | ) | [static] |
Definition at line 1484 of file btree.c.
References BtShared::pTmpSpace, and sqlite3PageFree().
Referenced by lockBtree(), sqlite3BtreeClose(), and sqlite3BtreeSetPageSize().
Definition at line 1118 of file btree.c.
References btreePageFromDbPage(), MemPage::isInit, BtShared::mutex, pagerPagecount(), BtShared::pPager, releasePage(), sqlite3_mutex_held, sqlite3BtreeGetPage(), sqlite3BtreeInitPage(), sqlite3PagerLookup(), SQLITE_CORRUPT_BKPT, and SQLITE_OK.
Referenced by balance_nonroot(), btreeCursor(), clearDatabasePage(), moveToChild(), and moveToRoot().
static int getOverflowPage | ( | BtShared * | pBt, | |
Pgno | ovfl, | |||
MemPage ** | ppPage, | |||
Pgno * | pPgnoNext | |||
) | [static] |
Definition at line 3041 of file btree.c.
References MemPage::aData, BtShared::autoVacuum, get4byte, BtShared::mutex, next, pagerPagecount(), PENDING_BYTE_PAGE, BtShared::pPager, PTRMAP_ISPAGE, PTRMAP_OVERFLOW2, ptrmapGet(), releasePage(), sqlite3_mutex_held, sqlite3BtreeGetPage(), and SQLITE_OK.
Referenced by accessPayload(), and clearCell().
Definition at line 2255 of file btree.c.
References MemPage::aData, allocateBtreePage(), get4byte, BtShared::mutex, BtShared::nTrunc, pagerPagecount(), MemPage::pDbPage, PENDING_BYTE_PAGE, BtShared::pPage1, BtShared::pPager, PTRMAP_FREEPAGE, PTRMAP_ISPAGE, PTRMAP_ROOTPAGE, ptrmapGet(), releasePage(), relocatePage(), sqlite3_mutex_held, sqlite3BtreeGetPage(), sqlite3PagerWrite(), SQLITE_CORRUPT_BKPT, SQLITE_DONE, and SQLITE_OK.
Referenced by autoVacuumCommit(), and sqlite3BtreeIncrVacuum().
Definition at line 4614 of file btree.c.
References MemPage::aData, allocateSpace(), MemPage::aOvfl, BtShared::autoVacuum, MemPage::cellOffset, cellSizePtr(), defragmentPage(), get2byte, get4byte, MemPage::hdrOffset, MemPage::_OvflCell::idx, MemPage::intKey, CellInfo::iOverflow, BtShared::mutex, MemPage::nCell, CellInfo::nData, MemPage::nFree, CellInfo::nKey, CellInfo::nLocal, MemPage::nOverflow, CellInfo::nPayload, MemPage::pBt, MemPage::_OvflCell::pCell, MemPage::pDbPage, MemPage::pgno, PTRMAP_OVERFLOW1, ptrmapPut(), put2byte, sqlite3_mutex_held, sqlite3BtreeParseCellPtr(), sqlite3PagerWrite(), SQLITE_CORRUPT_BKPT, SQLITE_OK, and BtShared::usableSize.
Referenced by balance_nonroot(), balance_quick(), sqlite3BtreeDelete(), and sqlite3BtreeInsert().
static void invalidateAllOverflowCache | ( | BtShared * | pBt | ) | [static] |
Definition at line 287 of file btree.c.
References invalidateOverflowCache(), BtShared::mutex, BtShared::pCursor, BtCursor::pNext, and sqlite3_mutex_held.
Referenced by autoVacuumCommit(), btreeCreateTable(), and sqlite3BtreeIncrVacuum().
static void invalidateOverflowCache | ( | BtCursor * | pCur | ) | [static] |
Definition at line 277 of file btree.c.
References BtCursor::aOverflow, and sqlite3_free().
Referenced by invalidateAllOverflowCache(), saveCursorPosition(), and sqlite3BtreeCloseCursor().
static int lockBtree | ( | BtShared * | pBt | ) | [static] |
Definition at line 1729 of file btree.c.
References MemPage::aData, BtShared::autoVacuum, freeTempSpace(), get2byte, get4byte, BtShared::incrVacuum, BtShared::maxLeaf, BtShared::maxLocal, BtShared::minLeaf, BtShared::minLocal, BtShared::mutex, MX_CELL_SIZE, BtShared::pageSize, BtShared::pPage1, BtShared::pPager, BtShared::readOnly, releasePage(), sqlite3_mutex_held, sqlite3BtreeGetPage(), sqlite3PagerPagecount(), sqlite3PagerSetPagesize(), SQLITE_MAX_PAGE_SIZE, SQLITE_NOTADB, SQLITE_OK, BtShared::usableSize, and zMagicHeader.
Referenced by sqlite3BtreeBeginTrans().
static int lockBtreeWithRetry | ( | Btree * | pRef | ) | [static] |
Definition at line 1832 of file btree.c.
References btreeIntegrity, Btree::inTrans, BtShared::inTransaction, BtShared::nTransaction, Btree::pBt, sqlite3BtreeBeginTrans(), SQLITE_OK, and TRANS_NONE.
Referenced by btreeCursor(), and sqlite3BtreeIntegrityCheck().
Definition at line 168 of file btree.c.
References Btree::db, BtLock::eLock, sqlite3::flags, BtLock::iTable, MASTER_ROOT, Btree::pBt, BtLock::pBtree, BtShared::pLock, BtLock::pNext, queryTableLock(), READ_LOCK, Btree::sharable, sqlite3MallocZero(), SQLITE_NOMEM, SQLITE_OK, SQLITE_ReadUncommitted, and WRITE_LOCK.
Referenced by sqlite3BtreeGetMeta(), and sqlite3BtreeLockTable().
Definition at line 2111 of file btree.c.
References MemPage::aData, findCell, get4byte, MemPage::hdrOffset, CellInfo::iOverflow, MemPage::isInit, BtShared::mutex, MemPage::nCell, MemPage::pBt, PTRMAP_BTREE, PTRMAP_OVERFLOW1, PTRMAP_OVERFLOW2, put4byte, sqlite3_mutex_held, sqlite3BtreeInitPage(), sqlite3BtreeParseCellPtr(), SQLITE_CORRUPT_BKPT, and SQLITE_OK.
Referenced by relocatePage().
Definition at line 3450 of file btree.c.
References BtCursor::aiIdx, BtCursor::apPage, BTCURSOR_MAX_DEPTH, CURSOR_VALID, BtCursor::eState, getAndInitPage(), BtCursor::info, BtCursor::iPage, MemPage::nCell, CellInfo::nSize, BtCursor::pBt, SQLITE_CORRUPT_BKPT, SQLITE_OK, and BtCursor::validNKey.
Referenced by moveToLeftmost(), moveToRightmost(), moveToRoot(), sqlite3BtreeMovetoUnpacked(), sqlite3BtreeNext(), and sqlite3BtreePrevious().
static int moveToLeftmost | ( | BtCursor * | pCur | ) | [static] |
Definition at line 3582 of file btree.c.
References BtCursor::aiIdx, BtCursor::apPage, CURSOR_VALID, BtCursor::eState, findCell, get4byte, BtCursor::iPage, moveToChild(), MemPage::nCell, and SQLITE_OK.
Referenced by sqlite3BtreeFirst(), and sqlite3BtreeNext().
static int moveToRightmost | ( | BtCursor * | pCur | ) | [static] |
Definition at line 3607 of file btree.c.
References MemPage::aData, BtCursor::aiIdx, BtCursor::apPage, CURSOR_VALID, BtCursor::eState, get4byte, MemPage::hdrOffset, BtCursor::info, BtCursor::iPage, moveToChild(), MemPage::nCell, CellInfo::nSize, SQLITE_OK, and BtCursor::validNKey.
Referenced by sqlite3BtreeLast(), and sqlite3BtreePrevious().
static int moveToRoot | ( | BtCursor * | pCur | ) | [static] |
Definition at line 3523 of file btree.c.
References MemPage::aData, BtCursor::aiIdx, BtCursor::apPage, BtCursor::atLast, CURSOR_FAULT, CURSOR_INVALID, CURSOR_REQUIRESEEK, CURSOR_VALID, BtCursor::eState, get4byte, getAndInitPage(), MemPage::hdrOffset, BtCursor::info, BtCursor::iPage, MemPage::leaf, moveToChild(), MemPage::nCell, CellInfo::nSize, Btree::pBt, BtCursor::pBtree, MemPage::pgno, BtCursor::pgnoRoot, releasePage(), BtCursor::skip, sqlite3BtreeClearCursor(), SQLITE_OK, and BtCursor::validNKey.
Referenced by sqlite3BtreeDelete(), sqlite3BtreeFirst(), sqlite3BtreeInsert(), sqlite3BtreeLast(), and sqlite3BtreeMovetoUnpacked().
static int newDatabase | ( | BtShared * | pBt | ) | [static] |
Definition at line 1885 of file btree.c.
References MemPage::aData, BtShared::autoVacuum, BtShared::incrVacuum, BtShared::mutex, BtShared::pageSize, BtShared::pageSizeFixed, MemPage::pDbPage, BtShared::pPage1, BtShared::pPager, PTF_INTKEY, PTF_LEAF, PTF_LEAFDATA, put2byte, put4byte, sqlite3_mutex_held, sqlite3PagerPagecount(), sqlite3PagerWrite(), SQLITE_OK, BtShared::usableSize, zeroPage(), and zMagicHeader.
Referenced by sqlite3BtreeBeginTrans().
static void pageReinit | ( | DbPage * | pData | ) | [static] |
Definition at line 1184 of file btree.c.
References MemPage::isInit, BtShared::mutex, MemPage::pBt, sqlite3_mutex_held, sqlite3BtreeInitPage(), sqlite3PagerGetExtra(), and sqlite3PagerPageRefcount().
Referenced by sqlite3BtreeOpen().
static int pagerPagecount | ( | Pager * | pPager | ) | [static] |
Definition at line 1106 of file btree.c.
References sqlite3PagerPagecount(), and SQLITE_OK.
Referenced by allocateBtreePage(), autoVacuumCommit(), balance_shallower(), btreeCopyFile(), btreeCursor(), clearCell(), clearDatabasePage(), getAndInitPage(), getOverflowPage(), incrVacuumStep(), and sqlite3BtreeIntegrityCheck().
Definition at line 499 of file btree.c.
References get4byte, BtShared::mutex, BtShared::pPager, PTRMAP_PAGENO, PTRMAP_PTROFFSET, sqlite3_mutex_held, sqlite3PagerGet, sqlite3PagerGetData(), sqlite3PagerUnref(), SQLITE_CORRUPT_BKPT, and SQLITE_OK.
Referenced by allocateBtreePage(), btreeCreateTable(), checkPtrmap(), getOverflowPage(), and incrVacuumStep().
Definition at line 437 of file btree.c.
References BtShared::mutex, PENDING_BYTE_PAGE, sqlite3_mutex_held, and BtShared::usableSize.
Definition at line 456 of file btree.c.
References BtShared::autoVacuum, get4byte, BtShared::mutex, PENDING_BYTE_PAGE, BtShared::pPager, PTRMAP_ISPAGE, PTRMAP_PAGENO, PTRMAP_PTROFFSET, put4byte, sqlite3_mutex_held, sqlite3PagerGet, sqlite3PagerGetData(), sqlite3PagerUnref(), sqlite3PagerWrite(), SQLITE_CORRUPT_BKPT, SQLITE_OK, and TRACE.
Referenced by balance_deeper(), balance_nonroot(), balance_quick(), btreeCreateTable(), fillInCell(), freePage(), insertCell(), ptrmapPutOvflPtr(), relocatePage(), and setChildPtrmaps().
static int ptrmapPutOvfl | ( | MemPage * | pPage, | |
int | iCell | |||
) | [static] |
Definition at line 690 of file btree.c.
References findOverflowCell(), BtShared::mutex, MemPage::pBt, ptrmapPutOvflPtr(), and sqlite3_mutex_held.
Referenced by balance_nonroot(), and balance_quick().
Definition at line 674 of file btree.c.
References get4byte, MemPage::intKey, CellInfo::iOverflow, CellInfo::nData, CellInfo::nKey, CellInfo::nLocal, CellInfo::nPayload, MemPage::pBt, MemPage::pgno, PTRMAP_OVERFLOW1, ptrmapPut(), sqlite3BtreeParseCellPtr(), and SQLITE_OK.
Referenced by ptrmapPutOvfl(), and setChildPtrmaps().
Definition at line 109 of file btree.c.
References Btree::db, BtLock::eLock, sqlite3::flags, BtLock::iTable, MASTER_ROOT, Btree::pBt, BtLock::pBtree, BtShared::pExclusive, BtShared::pLock, BtLock::pNext, READ_LOCK, Btree::sharable, SQLITE_LOCKED, SQLITE_OK, SQLITE_ReadUncommitted, and WRITE_LOCK.
Referenced by lockTable(), sqlite3BtreeGetMeta(), sqlite3BtreeLockTable(), and sqlite3BtreeSchemaLocked().
static void releasePage | ( | MemPage * | pPage | ) | [static] |
Definition at line 1165 of file btree.c.
References MemPage::aData, MemPage::pBt, MemPage::pDbPage, sqlite3_mutex_held, sqlite3PagerGetData(), sqlite3PagerGetExtra(), and sqlite3PagerUnref().
Referenced by allocateBtreePage(), balance_deeper(), balance_nonroot(), balance_quick(), balance_shallower(), btreeCreateTable(), btreeCursor(), btreeDropTable(), checkTreePage(), clearDatabasePage(), fillInCell(), freePage(), getAndInitPage(), getOverflowPage(), incrVacuumStep(), lockBtree(), moveToRoot(), relocatePage(), saveCursorPosition(), sqlite3BtreeCloseCursor(), sqlite3BtreeMoveToParent(), sqlite3BtreeRollback(), and unlockBtreeIfUnused().
static int relocatePage | ( | BtShared * | pBt, | |
MemPage * | pDbPage, | |||
u8 | eType, | |||
Pgno | iPtrPage, | |||
Pgno | iFreePage, | |||
int | isCommit | |||
) | [static] |
Definition at line 2164 of file btree.c.
References MemPage::aData, get4byte, modifyPagePointer(), BtShared::mutex, MemPage::pBt, MemPage::pDbPage, MemPage::pgno, BtShared::pPager, PTRMAP_BTREE, PTRMAP_OVERFLOW1, PTRMAP_OVERFLOW2, PTRMAP_ROOTPAGE, ptrmapPut(), releasePage(), setChildPtrmaps(), sqlite3_mutex_held, sqlite3BtreeGetPage(), sqlite3PagerMovepage(), sqlite3PagerWrite(), SQLITE_OK, and TRACE.
Referenced by btreeCreateTable(), btreeDropTable(), and incrVacuumStep().
static int removeFromSharingList | ( | BtShared * | pBt | ) | [static] |
Definition at line 1437 of file btree.c.
References ALWAYS, GLOBAL, BtShared::mutex, BtShared::nRef, BtShared::pNext, sqlite3_mutex_enter, sqlite3_mutex_free, sqlite3_mutex_leave, sqlite3_mutex_notheld, sqlite3MutexAlloc, sqlite3SharedCacheList, SQLITE_MUTEX_STATIC_MASTER, and SQLITE_THREADSAFE.
Referenced by sqlite3BtreeClose().
Definition at line 352 of file btree.c.
References CURSOR_VALID, BtCursor::eState, BtShared::mutex, BtCursor::pBt, BtShared::pCursor, BtCursor::pgnoRoot, BtCursor::pNext, saveCursorPosition(), sqlite3_mutex_held, and SQLITE_OK.
Referenced by sqlite3BtreeClearTable(), sqlite3BtreeDelete(), sqlite3BtreeInsert(), and sqlite3BtreeRollback().
static int saveCursorPosition | ( | BtCursor * | pCur | ) | [static] |
Definition at line 303 of file btree.c.
References BtCursor::apPage, CURSOR_REQUIRESEEK, CURSOR_VALID, BtCursor::eState, MemPage::intKey, invalidateOverflowCache(), BtCursor::iPage, BtCursor::nKey, BtCursor::pKey, releasePage(), sqlite3_free(), sqlite3BtreeKey(), sqlite3BtreeKeySize(), sqlite3Malloc(), SQLITE_NOMEM, and SQLITE_OK.
Referenced by saveAllCursors(), and sqlite3BtreeDelete().
static int setChildPtrmaps | ( | MemPage * | pPage | ) | [static] |
Definition at line 2056 of file btree.c.
References MemPage::aData, findCell, get4byte, MemPage::hdrOffset, MemPage::isInit, MemPage::leaf, BtShared::mutex, MemPage::nCell, MemPage::pBt, MemPage::pgno, PTRMAP_BTREE, ptrmapPut(), ptrmapPutOvflPtr(), sqlite3_mutex_held, sqlite3BtreeInitPage(), and SQLITE_OK.
Referenced by balance_deeper(), balance_shallower(), and relocatePage().
int sqlite3_enable_shared_cache | ( | int | enable | ) |
Definition at line 75 of file btree.c.
References sqlite3GlobalConfig, and SQLITE_OK.
int sqlite3BtreeBeginStmt | ( | Btree * | p | ) |
Definition at line 2699 of file btree.c.
References Btree::db, BtShared::db, BtShared::inStmt, Btree::inTrans, BtShared::inTransaction, Btree::pBt, BtShared::pPager, BtShared::readOnly, sqlite3BtreeEnter, sqlite3BtreeLeave, sqlite3PagerStmtBegin(), SQLITE_ERROR, SQLITE_OK, SQLITE_READONLY, and TRANS_WRITE.
Referenced by sqlite3VdbeExec().
int sqlite3BtreeBeginTrans | ( | Btree * | p, | |
int | wrflag | |||
) |
Definition at line 1957 of file btree.c.
References btreeIntegrity, Btree::db, BtShared::db, BtShared::inStmt, Btree::inTrans, BtShared::inTransaction, lockBtree(), newDatabase(), BtShared::nTransaction, Btree::pBt, BtLock::pBtree, MemPage::pDbPage, BtShared::pExclusive, BtShared::pLock, BtLock::pNext, BtShared::pPage1, BtShared::readOnly, sqlite3BtreeEnter, sqlite3BtreeInvokeBusyHandler(), sqlite3BtreeLeave, sqlite3PagerBegin(), SQLITE_BUSY, SQLITE_OK, SQLITE_READONLY, TRANS_NONE, TRANS_READ, TRANS_WRITE, and unlockBtreeIfUnused().
Referenced by lockBtreeWithRetry(), and sqlite3VdbeExec().
void sqlite3BtreeCacheOverflow | ( | BtCursor * | pCur | ) |
Definition at line 7408 of file btree.c.
References BtCursor::aOverflow, Btree::db, BtCursor::isIncrblobHandle, sqlite3::mutex, BtCursor::pBtree, and sqlite3_mutex_held.
Referenced by sqlite3_blob_open().
void sqlite3BtreeClearCursor | ( | BtCursor * | pCur | ) |
Definition at line 371 of file btree.c.
References CURSOR_INVALID, BtCursor::eState, BtCursor::pKey, and sqlite3_free().
Referenced by moveToRoot(), sqlite3BtreeCloseCursor(), sqlite3BtreeInsert(), sqlite3BtreeTripAllCursors(), and sqlite3VdbeExec().
int sqlite3BtreeClearTable | ( | Btree * | p, | |
int | iTable, | |||
int * | pnChange | |||
) |
Definition at line 6269 of file btree.c.
References checkReadLocks(), clearDatabasePage(), Btree::db, BtShared::db, Btree::inTrans, Btree::pBt, BtShared::readOnly, saveAllCursors(), sqlite3BtreeEnter, sqlite3BtreeLeave, SQLITE_ERROR, SQLITE_OK, SQLITE_READONLY, and TRANS_WRITE.
Referenced by btreeDropTable(), and sqlite3VdbeExec().
int sqlite3BtreeClose | ( | Btree * | p | ) |
Definition at line 1492 of file btree.c.
References BtShared::db, Btree::db, freeTempSpace(), Btree::locked, sqlite3::mutex, Btree::pBt, BtCursor::pBtree, BtShared::pCursor, Btree::pNext, BtCursor::pNext, BtShared::pPager, Btree::pPrev, BtShared::pSchema, removeFromSharingList(), Btree::sharable, sqlite3_free(), sqlite3_mutex_held, sqlite3BtreeCloseCursor(), sqlite3BtreeEnter, sqlite3BtreeLeave, sqlite3BtreeRollback(), sqlite3PagerClose(), SQLITE_OK, Btree::wantToLock, and BtShared::xFreeSchema.
Referenced by attachFunc(), detachFunc(), invalidateTempStorage(), sqlite3_close(), sqlite3RunVacuum(), and sqlite3VdbeFreeCursor().
int sqlite3BtreeCloseCursor | ( | BtCursor * | pCur | ) |
Definition at line 2871 of file btree.c.
References BtCursor::apPage, Btree::db, BtShared::db, invalidateOverflowCache(), BtCursor::iPage, BtCursor::pBt, BtCursor::pBtree, BtShared::pCursor, BtCursor::pNext, BtCursor::pPrev, releasePage(), sqlite3BtreeClearCursor(), sqlite3BtreeEnter, sqlite3BtreeLeave, SQLITE_OK, and unlockBtreeIfUnused().
Referenced by schemaIsValid(), sqlite3BtreeClose(), sqlite3InitOne(), and sqlite3VdbeFreeCursor().
int sqlite3BtreeCommit | ( | Btree * | p | ) |
Definition at line 2552 of file btree.c.
References sqlite3BtreeCommitPhaseOne(), sqlite3BtreeCommitPhaseTwo(), sqlite3BtreeEnter, sqlite3BtreeLeave, and SQLITE_OK.
Referenced by sqlite3RunVacuum().
int sqlite3BtreeCommitPhaseOne | ( | Btree * | p, | |
const char * | zMaster | |||
) |
Definition at line 2466 of file btree.c.
References BtShared::autoVacuum, autoVacuumCommit(), Btree::db, BtShared::db, Btree::inTrans, Btree::pBt, BtShared::pPager, sqlite3BtreeEnter, sqlite3BtreeLeave, sqlite3PagerCommitPhaseOne(), SQLITE_OK, and TRANS_WRITE.
Referenced by sqlite3BtreeCommit(), and vdbeCommit().
int sqlite3BtreeCommitPhaseTwo | ( | Btree * | p | ) |
Definition at line 2502 of file btree.c.
References btreeIntegrity, Btree::db, BtShared::db, BtShared::inStmt, Btree::inTrans, BtShared::inTransaction, BtShared::nTransaction, Btree::pBt, BtShared::pPager, sqlite3BtreeEnter, sqlite3BtreeLeave, sqlite3PagerCommitPhaseTwo(), SQLITE_OK, TRANS_NONE, TRANS_READ, TRANS_WRITE, unlockAllTables(), and unlockBtreeIfUnused().
Referenced by sqlite3BtreeCommit(), and vdbeCommit().
int sqlite3BtreeCommitStmt | ( | Btree * | p | ) |
Definition at line 2720 of file btree.c.
References Btree::db, BtShared::db, BtShared::inStmt, Btree::pBt, BtShared::pPager, BtShared::readOnly, sqlite3BtreeEnter, sqlite3BtreeLeave, sqlite3PagerStmtCommit(), and SQLITE_OK.
Referenced by sqlite3VdbeHalt().
Definition at line 7255 of file btree.c.
References btreeCopyFile(), sqlite3BtreeEnter, and sqlite3BtreeLeave.
Referenced by sqlite3RunVacuum().
int sqlite3BtreeCreateTable | ( | Btree * | p, | |
int * | piTable, | |||
int | flags | |||
) |
Definition at line 6197 of file btree.c.
References btreeCreateTable(), Btree::db, BtShared::db, Btree::pBt, sqlite3BtreeEnter, and sqlite3BtreeLeave.
Referenced by sqlite3VdbeExec().
int sqlite3BtreeCursor | ( | Btree * | p, | |
int | iTable, | |||
int | wrFlag, | |||
struct KeyInfo * | pKeyInfo, | |||
BtCursor * | pCur | |||
) |
Definition at line 2847 of file btree.c.
References btreeCursor(), Btree::db, BtShared::db, Btree::pBt, sqlite3BtreeEnter, and sqlite3BtreeLeave.
Referenced by schemaIsValid(), sqlite3InitOne(), and sqlite3VdbeExec().
Definition at line 3895 of file btree.c.
References Btree::db, sqlite3::mutex, BtCursor::pBtree, and sqlite3_mutex_held.
Referenced by sqlite3VdbeMemFromBtree().
int sqlite3BtreeCursorHasMoved | ( | BtCursor * | pCur, | |
int * | pHasMoved | |||
) |
Definition at line 415 of file btree.c.
References CURSOR_VALID, BtCursor::eState, restoreCursorPosition, BtCursor::skip, and SQLITE_OK.
Referenced by sqlite3VdbeCursorMoveto().
int sqlite3BtreeCursorSize | ( | void | ) |
Definition at line 2861 of file btree.c.
Referenced by allocateCursor(), schemaIsValid(), and sqlite3InitOne().
Definition at line 3340 of file btree.c.
References accessPayload(), BtCursor::aiIdx, BtCursor::apPage, CURSOR_INVALID, CURSOR_VALID, BtCursor::eState, BtCursor::iPage, MemPage::nCell, restoreCursorPosition, SQLITE_ABORT, and SQLITE_OK.
Referenced by sqlite3_blob_read(), sqlite3VdbeExec(), and sqlite3VdbeMemFromBtree().
const void* sqlite3BtreeDataFetch | ( | BtCursor * | pCur, | |
int * | pAmt | |||
) |
Definition at line 3437 of file btree.c.
References CURSOR_VALID, BtCursor::eState, and fetchPayload().
Referenced by sqlite3VdbeExec(), and sqlite3VdbeMemFromBtree().
Definition at line 3006 of file btree.c.
References CURSOR_INVALID, CURSOR_VALID, BtCursor::eState, getCellInfo, BtCursor::info, CellInfo::nData, restoreCursorPosition, and SQLITE_OK.
Referenced by sqlite3VdbeExec().
int sqlite3BtreeDelete | ( | BtCursor * | pCur | ) |
Definition at line 5858 of file btree.c.
References BtCursor::aiIdx, allocateTempSpace(), BtCursor::apPage, balance(), cellSizePtr(), checkReadLocks(), clearCell(), CURSOR_FAULT, dropCell(), BtCursor::eState, findCell, findOverflowCell(), get4byte, BtCursor::info, insertCell(), MemPage::intKey, BtShared::inTransaction, BtCursor::iPage, MemPage::isInit, MemPage::leaf, moveToRoot(), MX_CELL_SIZE, MemPage::nCell, MemPage::nFree, CellInfo::nKey, MemPage::nOverflow, Btree::pBt, BtCursor::pBtree, MemPage::pDbPage, MemPage::pgno, BtCursor::pgnoRoot, BtShared::pTmpSpace, put4byte, BtShared::readOnly, restoreCursorPosition, saveAllCursors(), saveCursorPosition(), BtCursor::skip, sqlite3BtreeGetTempCursor(), sqlite3BtreeNext(), sqlite3BtreeReleaseTempCursor(), sqlite3PagerWrite(), SQLITE_ERROR, SQLITE_LOCKED, SQLITE_NOMEM, SQLITE_OK, SQLITE_PERM, SQLITE_READONLY, testcase, TRACE, TRANS_WRITE, BtShared::usableSize, VVA_ONLY, and BtCursor::wrFlag.
Referenced by sqlite3VdbeExec().
int sqlite3BtreeDropTable | ( | Btree * | p, | |
int | iTable, | |||
int * | piMoved | |||
) |
Definition at line 6414 of file btree.c.
References btreeDropTable(), Btree::db, BtShared::db, Btree::pBt, sqlite3BtreeEnter, and sqlite3BtreeLeave.
Referenced by sqlite3VdbeExec().
int sqlite3BtreeEof | ( | BtCursor * | pCur | ) |
Definition at line 3884 of file btree.c.
References CURSOR_VALID, and BtCursor::eState.
Referenced by sqlite3VdbeExec().
int sqlite3BtreeFirst | ( | BtCursor * | pCur, | |
int * | pRes | |||
) |
Definition at line 3631 of file btree.c.
References BtCursor::apPage, CURSOR_INVALID, Btree::db, BtCursor::eState, BtCursor::iPage, moveToLeftmost(), moveToRoot(), sqlite3::mutex, MemPage::nCell, BtCursor::pBtree, sqlite3_mutex_held, and SQLITE_OK.
Referenced by sqlite3VdbeExec().
int sqlite3BtreeFlags | ( | BtCursor * | pCur | ) |
Definition at line 6531 of file btree.c.
References MemPage::aData, BtCursor::apPage, MemPage::hdrOffset, BtCursor::iPage, BtCursor::pBt, MemPage::pBt, and restoreCursorPosition.
Referenced by sqlite3VdbeExec().
int sqlite3BtreeGetAutoVacuum | ( | Btree * | p | ) |
Definition at line 1703 of file btree.c.
References BtShared::autoVacuum, BTREE_AUTOVACUUM_FULL, BTREE_AUTOVACUUM_INCR, BTREE_AUTOVACUUM_NONE, BtShared::incrVacuum, Btree::pBt, sqlite3BtreeEnter, and sqlite3BtreeLeave.
Referenced by sqlite3Pragma(), and sqlite3RunVacuum().
const char* sqlite3BtreeGetDirname | ( | Btree * | p | ) |
Definition at line 7027 of file btree.c.
References Btree::pBt, BtShared::pPager, and sqlite3PagerDirname().
Referenced by vdbeCommit().
const char* sqlite3BtreeGetFilename | ( | Btree * | p | ) |
Definition at line 7016 of file btree.c.
References Btree::pBt, BtShared::pPager, and sqlite3PagerFilename().
Referenced by sqlite3Pragma(), and vdbeCommit().
const char* sqlite3BtreeGetJournalname | ( | Btree * | p | ) |
Definition at line 7040 of file btree.c.
References Btree::pBt, BtShared::pPager, and sqlite3PagerJournalname().
Referenced by vdbeCommit().
Definition at line 6434 of file btree.c.
References MemPage::aData, Btree::db, BtShared::db, get4byte, lockTable(), Btree::pBt, BtShared::pPage1, BtShared::pPager, queryTableLock(), READ_LOCK, BtShared::readOnly, sqlite3BtreeEnter, sqlite3BtreeLeave, sqlite3PagerGet, sqlite3PagerGetData(), sqlite3PagerUnref(), and SQLITE_OK.
Referenced by btreeCreateTable(), btreeDropTable(), schemaIsValid(), sqlite3InitOne(), sqlite3RunVacuum(), and sqlite3VdbeExec().
Definition at line 1086 of file btree.c.
References btreePageFromDbPage(), BtShared::mutex, BtShared::pPager, sqlite3_mutex_held, sqlite3PagerAcquire(), and SQLITE_OK.
Referenced by allocateBtreePage(), balance_shallower(), btreeCreateTable(), btreeDropTable(), checkTreePage(), freePage(), getAndInitPage(), getOverflowPage(), incrVacuumStep(), lockBtree(), relocatePage(), and sqlite3BtreeRollback().
int sqlite3BtreeGetPageSize | ( | Btree * | p | ) |
Definition at line 1649 of file btree.c.
References BtShared::pageSize, and Btree::pBt.
Referenced by sqlite3Pragma(), and sqlite3RunVacuum().
int sqlite3BtreeGetReserve | ( | Btree * | p | ) |
Definition at line 1652 of file btree.c.
References BtShared::pageSize, Btree::pBt, sqlite3BtreeEnter, sqlite3BtreeLeave, and BtShared::usableSize.
Referenced by sqlite3RunVacuum().
Definition at line 2902 of file btree.c.
References BtCursor::apPage, BtCursor::iPage, MemPage::pDbPage, BtCursor::pNext, BtCursor::pPrev, and sqlite3PagerRef().
Referenced by sqlite3BtreeDelete().
int sqlite3BtreeIncrVacuum | ( | Btree * | p | ) |
Definition at line 2352 of file btree.c.
References BtShared::autoVacuum, Btree::db, BtShared::db, incrVacuumStep(), Btree::inTrans, BtShared::inTransaction, invalidateAllOverflowCache(), Btree::pBt, sqlite3BtreeEnter, sqlite3BtreeLeave, SQLITE_DONE, and TRANS_WRITE.
Referenced by sqlite3VdbeExec().
int sqlite3BtreeInitPage | ( | MemPage * | pPage | ) |
Definition at line 944 of file btree.c.
References MemPage::aData, MemPage::cellOffset, decodeFlags(), get2byte, MemPage::hdrOffset, MemPage::isInit, MemPage::leaf, MemPage::maskPage, BtShared::mutex, MX_CELL, MemPage::nCell, next, MemPage::nFree, MemPage::nOverflow, BtShared::pageSize, MemPage::pBt, MemPage::pDbPage, MemPage::pgno, sqlite3_mutex_held, sqlite3PagerGetData(), sqlite3PagerGetExtra(), SQLITE_CORRUPT_BKPT, SQLITE_OK, and BtShared::usableSize.
Referenced by balance_deeper(), balance_quick(), balance_shallower(), checkTreePage(), getAndInitPage(), modifyPagePointer(), pageReinit(), and setChildPtrmaps().
int sqlite3BtreeInsert | ( | BtCursor * | pCur, | |
const void * | pKey, | |||
i64 | nKey, | |||
const void * | pData, | |||
int | nData, | |||
int | nZero, | |||
int | appendBias | |||
) |
Definition at line 5760 of file btree.c.
References BtCursor::aiIdx, allocateTempSpace(), BtCursor::apPage, balance(), cellSizePtr(), checkReadLocks(), clearCell(), CURSOR_FAULT, CURSOR_VALID, dropCell(), BtCursor::eState, fillInCell(), findCell, BtCursor::info, insertCell(), MemPage::intKey, BtShared::inTransaction, BtCursor::iPage, MemPage::isInit, MemPage::leaf, moveToRoot(), MX_CELL_SIZE, CellInfo::nSize, Btree::pBt, BtCursor::pBtree, MemPage::pDbPage, MemPage::pgno, BtCursor::pgnoRoot, BtShared::pTmpSpace, BtShared::readOnly, saveAllCursors(), BtCursor::skip, sqlite3BtreeClearCursor(), sqlite3BtreeMoveto(), sqlite3PagerWrite(), SQLITE_ERROR, SQLITE_LOCKED, SQLITE_NOMEM, SQLITE_OK, SQLITE_PERM, SQLITE_READONLY, TRACE, TRANS_WRITE, BtCursor::validNKey, and BtCursor::wrFlag.
Referenced by sqlite3VdbeExec().
char* sqlite3BtreeIntegrityCheck | ( | Btree * | p, | |
int * | aRoot, | |||
int | nRoot, | |||
int | mxErr, | |||
int * | pnErr | |||
) |
Definition at line 6894 of file btree.c.
References MemPage::aData, IntegrityCk::anRef, BtShared::autoVacuum, checkAppendMsg(), checkList(), checkPtrmap(), checkTreePage(), Btree::db, BtShared::db, IntegrityCk::errMsg, get4byte, lockBtreeWithRetry(), IntegrityCk::mallocFailed, IntegrityCk::mxErr, IntegrityCk::nErr, IntegrityCk::nPage, BtShared::nTrunc, pagerPagecount(), IntegrityCk::pBt, Btree::pBt, PENDING_BYTE_PAGE, BtShared::pPage1, IntegrityCk::pPager, BtShared::pPager, PTRMAP_PAGENO, PTRMAP_ROOTPAGE, sqlite3_free(), sqlite3BtreeEnter, sqlite3BtreeLeave, sqlite3DbStrDup(), sqlite3Malloc(), sqlite3PagerRefcount(), sqlite3StrAccumFinish(), sqlite3StrAccumInit(), sqlite3StrAccumReset(), SQLITE_OK, and unlockBtreeIfUnused().
Referenced by sqlite3VdbeExec().
static int sqlite3BtreeInvokeBusyHandler | ( | void * | pArg, | |
int | n | |||
) | [static] |
Definition at line 1199 of file btree.c.
References sqlite3::busyHandler, BtShared::db, sqlite3::mutex, sqlite3_mutex_held, and sqlite3InvokeBusyHandler().
Referenced by sqlite3BtreeBeginTrans(), and sqlite3BtreeOpen().
int sqlite3BtreeIsInReadTrans | ( | Btree * | p | ) |
Definition at line 7286 of file btree.c.
References Btree::db, Btree::inTrans, sqlite3::mutex, sqlite3_mutex_held, and TRANS_NONE.
Referenced by detachFunc(), and invalidateTempStorage().
int sqlite3BtreeIsInStmt | ( | Btree * | p | ) |
Definition at line 7278 of file btree.c.
References BtShared::inStmt, and Btree::pBt.
Referenced by sqlite3VdbeExec().
int sqlite3BtreeIsInTrans | ( | Btree * | p | ) |
Definition at line 7270 of file btree.c.
References Btree::db, Btree::inTrans, sqlite3::mutex, sqlite3_mutex_held, and TRANS_WRITE.
Referenced by invalidateCursorsOnModifiedBtrees(), sqlite3RollbackAll(), sqlite3RunVacuum(), sqlite3VdbeExec(), and vdbeCommit().
Definition at line 3314 of file btree.c.
References accessPayload(), BtCursor::aiIdx, BtCursor::apPage, CURSOR_VALID, BtCursor::eState, MemPage::intKey, BtCursor::iPage, MemPage::nCell, restoreCursorPosition, SQLITE_CORRUPT_BKPT, and SQLITE_OK.
Referenced by saveCursorPosition(), sqlite3BtreeMovetoUnpacked(), sqlite3VdbeExec(), and sqlite3VdbeMemFromBtree().
const void* sqlite3BtreeKeyFetch | ( | BtCursor * | pCur, | |
int * | pAmt | |||
) |
Definition at line 3430 of file btree.c.
References CURSOR_VALID, BtCursor::eState, and fetchPayload().
Referenced by sqlite3VdbeExec(), and sqlite3VdbeMemFromBtree().
Definition at line 2982 of file btree.c.
References CURSOR_INVALID, CURSOR_VALID, BtCursor::eState, getCellInfo, BtCursor::info, CellInfo::nKey, restoreCursorPosition, and SQLITE_OK.
Referenced by saveCursorPosition(), sqlite3VdbeExec(), sqlite3VdbeIdxKeyCompare(), and sqlite3VdbeIdxRowid().
int sqlite3BtreeLast | ( | BtCursor * | pCur, | |
int * | pRes | |||
) |
Definition at line 3655 of file btree.c.
References BtCursor::apPage, BtCursor::atLast, CURSOR_INVALID, CURSOR_VALID, Btree::db, BtCursor::eState, getCellInfo, BtCursor::iPage, moveToRightmost(), moveToRoot(), sqlite3::mutex, MemPage::nCell, BtCursor::pBtree, sqlite3_mutex_held, and SQLITE_OK.
Referenced by sqlite3VdbeExec().
Definition at line 7342 of file btree.c.
References lockTable(), queryTableLock(), READ_LOCK, Btree::sharable, sqlite3BtreeEnter, sqlite3BtreeLeave, SQLITE_OK, and WRITE_LOCK.
Referenced by sqlite3VdbeExec().
int sqlite3BtreeMaxPageCount | ( | Btree * | p, | |
int | mxPage | |||
) |
Definition at line 1665 of file btree.c.
References Btree::pBt, BtShared::pPager, sqlite3BtreeEnter, sqlite3BtreeLeave, and sqlite3PagerMaxPageCount().
Referenced by sqlite3Pragma().
Definition at line 3851 of file btree.c.
References BtCursor::pKeyInfo, sqlite3BtreeMovetoUnpacked(), sqlite3VdbeDeleteUnpackedRecord(), sqlite3VdbeRecordUnpack(), and SQLITE_NOMEM.
Referenced by sqlite3BtreeInsert(), and sqlite3BtreeRestoreCursorPosition().
void sqlite3BtreeMoveToParent | ( | BtCursor * | pCur | ) |
Definition at line 3504 of file btree.c.
References BtCursor::aiIdx, BtCursor::apPage, assertParentIndex, CURSOR_VALID, BtCursor::eState, BtCursor::info, BtCursor::iPage, CellInfo::nSize, MemPage::pgno, releasePage(), and BtCursor::validNKey.
Referenced by sqlite3BtreeNext(), and sqlite3BtreePrevious().
int sqlite3BtreeMovetoUnpacked | ( | BtCursor * | pCur, | |
UnpackedRecord * | pIdxKey, | |||
i64 | intKey, | |||
int | biasRight, | |||
int * | pRes | |||
) |
Definition at line 3703 of file btree.c.
References MemPage::aData, BtCursor::aiIdx, BtCursor::apPage, BtCursor::atLast, MemPage::childPtrSize, CURSOR_INVALID, CURSOR_VALID, Btree::db, BtCursor::eState, fetchPayload(), findCell, get4byte, getVarint, getVarint32, MemPage::hasData, MemPage::hdrOffset, BtCursor::info, MemPage::intKey, BtCursor::iPage, MemPage::isInit, MemPage::leaf, moveToChild(), moveToRoot(), sqlite3::mutex, MemPage::nCell, CellInfo::nKey, CellInfo::nSize, BtCursor::pBtree, sqlite3_free(), sqlite3_mutex_held, sqlite3BtreeKey(), sqlite3Malloc(), sqlite3VdbeRecordCompare(), SQLITE_CORRUPT_BKPT, SQLITE_NOMEM, SQLITE_OK, and BtCursor::validNKey.
Referenced by sqlite3BtreeMoveto(), sqlite3VdbeCursorMoveto(), and sqlite3VdbeExec().
int sqlite3BtreeNext | ( | BtCursor * | pCur, | |
int * | pRes | |||
) |
Definition at line 3906 of file btree.c.
References MemPage::aData, BtCursor::aiIdx, BtCursor::apPage, CURSOR_INVALID, BtCursor::eState, get4byte, MemPage::hdrOffset, BtCursor::info, MemPage::intKey, BtCursor::iPage, MemPage::isInit, MemPage::leaf, moveToChild(), moveToLeftmost(), MemPage::nCell, CellInfo::nSize, restoreCursorPosition, BtCursor::skip, sqlite3BtreeMoveToParent(), sqlite3BtreeNext(), SQLITE_OK, and BtCursor::validNKey.
Referenced by sqlite3BtreeDelete(), sqlite3BtreeNext(), sqlite3VdbeCursorMoveto(), and sqlite3VdbeExec().
int sqlite3BtreeOpen | ( | const char * | zFilename, | |
sqlite3 * | db, | |||
Btree ** | ppBtree, | |||
int | flags, | |||
int | vfsFlags | |||
) |
Definition at line 1215 of file btree.c.
References sqlite3::aDb, BtShared::autoVacuum, BtShared::busyHdr, Btree::db, EXTRA_SIZE, sqlite3::flags, get2byte, get4byte, GLOBAL, BtShared::incrVacuum, Btree::inTrans, sqlite3::mallocFailed, BtShared::mutex, sqlite3::mutex, sqlite3_vfs::mxPathname, sqlite3::nDb, BtShared::nRef, pageReinit(), BtShared::pageSize, BtShared::pageSizeFixed, BusyHandler::pArg, Db::pBt, Btree::pBt, BtShared::pCursor, Btree::pNext, BtShared::pNext, BtShared::pPage1, BtShared::pPager, Btree::pPrev, sqlite3::pVfs, BtShared::readOnly, Btree::sharable, sqlite3_free(), sqlite3_mutex_enter, sqlite3_mutex_held, sqlite3_mutex_leave, sqlite3BtreeInvokeBusyHandler(), sqlite3GlobalConfig, sqlite3Malloc(), sqlite3MallocZero(), sqlite3MutexAlloc, sqlite3OsFullPathname(), sqlite3PagerClose(), sqlite3PagerFilename(), sqlite3PagerIsreadonly(), sqlite3PagerOpen(), sqlite3PagerReadFileheader(), sqlite3PagerSetBusyhandler(), sqlite3PagerSetPagesize(), sqlite3PagerSetReiniter(), sqlite3PagerVfs(), sqlite3SharedCacheList, SQLITE_DEFAULT_AUTOVACUUM, SQLITE_MAX_PAGE_SIZE, SQLITE_MUTEX_FAST, SQLITE_MUTEX_STATIC_MASTER, SQLITE_NOMEM, SQLITE_OK, SQLITE_SharedCache, SQLITE_THREADSAFE, SQLITE_Vtab, TRANS_NONE, BtShared::usableSize, and BusyHandler::xFunc.
Referenced by sqlite3BtreeFactory().
Definition at line 6548 of file btree.c.
References Btree::pBt, and BtShared::pPager.
Referenced by attachFunc(), openDatabase(), sqlite3_file_control(), sqlite3OpenTempDatabase(), sqlite3Pragma(), sqlite3RunVacuum(), and sqlite3VdbeExec().
Definition at line 572 of file btree.c.
References MemPage::childPtrSize, getVarint, getVarint32, MemPage::hasData, MemPage::intKey, CellInfo::iOverflow, MemPage::leaf, likely, MemPage::maxLocal, MemPage::minLocal, BtShared::mutex, CellInfo::nData, CellInfo::nHeader, CellInfo::nKey, CellInfo::nLocal, CellInfo::nPayload, CellInfo::nSize, MemPage::pBt, CellInfo::pCell, sqlite3_mutex_held, and BtShared::usableSize.
Referenced by balance_nonroot(), balance_quick(), cellSizePtr(), checkTreePage(), clearCell(), fillInCell(), insertCell(), modifyPagePointer(), and ptrmapPutOvflPtr().
int sqlite3BtreePrevious | ( | BtCursor * | pCur, | |
int * | pRes | |||
) |
Definition at line 3975 of file btree.c.
References BtCursor::aiIdx, BtCursor::apPage, BtCursor::atLast, CURSOR_INVALID, BtCursor::eState, findCell, get4byte, BtCursor::info, MemPage::intKey, BtCursor::iPage, MemPage::isInit, MemPage::leaf, moveToChild(), moveToRightmost(), CellInfo::nSize, restoreCursorPosition, BtCursor::skip, sqlite3BtreeMoveToParent(), sqlite3BtreePrevious(), SQLITE_OK, and BtCursor::validNKey.
Referenced by sqlite3BtreePrevious(), and sqlite3VdbeExec().
Definition at line 7367 of file btree.c.
References accessPayload(), BtCursor::apPage, checkReadLocks(), CURSOR_INVALID, CURSOR_REQUIRESEEK, CURSOR_VALID, Btree::db, BtCursor::eState, MemPage::intKey, BtShared::inTransaction, BtCursor::iPage, BtCursor::isIncrblobHandle, sqlite3::mutex, BtCursor::pBt, BtCursor::pBtree, BtCursor::pgnoRoot, BtShared::readOnly, restoreCursorPosition, sqlite3_mutex_held, SQLITE_ABORT, SQLITE_ERROR, SQLITE_LOCKED, SQLITE_READONLY, TRANS_WRITE, and BtCursor::wrFlag.
Referenced by sqlite3_blob_write().
void sqlite3BtreeReleaseTempCursor | ( | BtCursor * | pCur | ) |
Definition at line 2917 of file btree.c.
References BtCursor::apPage, BtCursor::iPage, MemPage::pDbPage, and sqlite3PagerUnref().
Referenced by sqlite3BtreeDelete().
int sqlite3BtreeRestoreCursorPosition | ( | BtCursor * | pCur | ) |
Definition at line 385 of file btree.c.
References CURSOR_FAULT, CURSOR_INVALID, CURSOR_REQUIRESEEK, CURSOR_VALID, BtCursor::eState, BtCursor::nKey, BtCursor::pKey, BtCursor::skip, sqlite3_free(), sqlite3BtreeMoveto(), and SQLITE_OK.
int sqlite3BtreeRollback | ( | Btree * | p | ) |
Definition at line 2621 of file btree.c.
References btreeIntegrity, Btree::db, BtShared::db, BtShared::inStmt, Btree::inTrans, BtShared::inTransaction, BtShared::nTransaction, BtShared::nTrunc, Btree::pBt, BtShared::pPager, releasePage(), saveAllCursors(), sqlite3BtreeEnter, sqlite3BtreeGetPage(), sqlite3BtreeLeave, sqlite3BtreeTripAllCursors(), sqlite3PagerRollback(), SQLITE_OK, TRANS_NONE, TRANS_READ, TRANS_WRITE, unlockAllTables(), and unlockBtreeIfUnused().
Referenced by btreeCopyFile(), sqlite3BtreeClose(), and sqlite3RollbackAll().
int sqlite3BtreeRollbackStmt | ( | Btree * | p | ) |
Definition at line 2743 of file btree.c.
References Btree::db, BtShared::db, BtShared::inStmt, Btree::pBt, BtShared::pPager, BtShared::readOnly, sqlite3BtreeEnter, sqlite3BtreeLeave, sqlite3PagerStmtRollback(), and SQLITE_OK.
Referenced by sqlite3VdbeHalt().
void* sqlite3BtreeSchema | ( | Btree * | p, | |
int | nBytes, | |||
void(*)(void *) | xFree | |||
) |
Definition at line 7311 of file btree.c.
References Btree::pBt, BtShared::pSchema, sqlite3BtreeEnter, sqlite3BtreeLeave, sqlite3MallocZero(), xFree(), and BtShared::xFreeSchema.
Referenced by sqlite3BtreeFactory(), and sqlite3SchemaGet().
int sqlite3BtreeSchemaLocked | ( | Btree * | p | ) |
Definition at line 7326 of file btree.c.
References Btree::db, MASTER_ROOT, sqlite3::mutex, queryTableLock(), READ_LOCK, sqlite3_mutex_held, sqlite3BtreeEnter, sqlite3BtreeLeave, and SQLITE_OK.
Referenced by sqlite3Prepare().
int sqlite3BtreeSetAutoVacuum | ( | Btree * | p, | |
int | autoVacuum | |||
) |
Definition at line 1680 of file btree.c.
References BtShared::autoVacuum, BtShared::pageSizeFixed, Btree::pBt, sqlite3BtreeEnter, sqlite3BtreeLeave, SQLITE_OK, and SQLITE_READONLY.
Referenced by sqlite3Pragma(), and sqlite3RunVacuum().
int sqlite3BtreeSetCacheSize | ( | Btree * | p, | |
int | mxPage | |||
) |
Definition at line 1563 of file btree.c.
References Btree::db, sqlite3::mutex, Btree::pBt, BtShared::pPager, sqlite3_mutex_held, sqlite3BtreeEnter, sqlite3BtreeLeave, sqlite3PagerSetCachesize(), and SQLITE_OK.
Referenced by sqlite3BtreeFactory(), sqlite3InitOne(), and sqlite3Pragma().
int sqlite3BtreeSetPageSize | ( | Btree * | p, | |
int | pageSize, | |||
int | nReserve | |||
) |
Definition at line 1622 of file btree.c.
References freeTempSpace(), BtShared::pageSize, BtShared::pageSizeFixed, Btree::pBt, BtShared::pCursor, BtShared::pPage1, BtShared::pPager, sqlite3BtreeEnter, sqlite3BtreeLeave, sqlite3PagerSetPagesize(), SQLITE_MAX_PAGE_SIZE, SQLITE_OK, SQLITE_READONLY, and BtShared::usableSize.
Referenced by sqlite3Pragma(), and sqlite3RunVacuum().
int sqlite3BtreeSetSafetyLevel | ( | Btree * | p, | |
int | level, | |||
int | fullSync | |||
) |
Definition at line 1581 of file btree.c.
References Btree::db, sqlite3::mutex, Btree::pBt, BtShared::pPager, sqlite3_mutex_held, sqlite3BtreeEnter, sqlite3BtreeLeave, sqlite3PagerSetSafetyLevel(), and SQLITE_OK.
Referenced by sqlite3Pragma().
int sqlite3BtreeSyncDisabled | ( | Btree * | p | ) |
Definition at line 1595 of file btree.c.
References Btree::db, sqlite3::mutex, Btree::pBt, BtShared::pPager, sqlite3_mutex_held, sqlite3BtreeEnter, sqlite3BtreeLeave, and sqlite3PagerNosync().
Referenced by vdbeCommit().
void sqlite3BtreeTripAllCursors | ( | Btree * | pBtree, | |
int | errCode | |||
) |
Definition at line 2601 of file btree.c.
References CURSOR_FAULT, BtCursor::eState, Btree::pBt, BtShared::pCursor, BtCursor::pNext, BtCursor::skip, sqlite3BtreeClearCursor(), sqlite3BtreeEnter, and sqlite3BtreeLeave.
Referenced by invalidateCursorsOnModifiedBtrees(), and sqlite3BtreeRollback().
Definition at line 6499 of file btree.c.
References MemPage::aData, BtShared::autoVacuum, Btree::db, BtShared::db, BtShared::incrVacuum, Btree::inTrans, Btree::pBt, MemPage::pDbPage, BtShared::pPage1, put4byte, BtShared::readOnly, sqlite3BtreeEnter, sqlite3BtreeLeave, sqlite3PagerWrite(), SQLITE_ERROR, SQLITE_OK, SQLITE_READONLY, and TRANS_WRITE.
Referenced by btreeCreateTable(), btreeDropTable(), sqlite3RunVacuum(), and sqlite3VdbeExec().
static void unlockAllTables | ( | Btree * | p | ) | [static] |
Definition at line 237 of file btree.c.
References Btree::pBt, BtLock::pBtree, BtShared::pExclusive, BtShared::pLock, BtLock::pNext, Btree::sharable, and sqlite3_free().
Referenced by sqlite3BtreeCommitPhaseTwo(), and sqlite3BtreeRollback().
static void unlockBtreeIfUnused | ( | BtShared * | pBt | ) | [static] |
Definition at line 1861 of file btree.c.
References MemPage::aData, BtShared::inStmt, BtShared::inTransaction, BtShared::mutex, MemPage::pBt, BtShared::pCursor, MemPage::pDbPage, MemPage::pgno, BtShared::pPage1, BtShared::pPager, releasePage(), sqlite3_mutex_held, sqlite3PagerGetData(), sqlite3PagerRefcount(), and TRANS_NONE.
Referenced by btreeCursor(), sqlite3BtreeBeginTrans(), sqlite3BtreeCloseCursor(), sqlite3BtreeCommitPhaseTwo(), sqlite3BtreeIntegrityCheck(), and sqlite3BtreeRollback().
static void zeroPage | ( | MemPage * | pPage, | |
int | flags | |||
) | [static] |
Definition at line 1032 of file btree.c.
References MemPage::aData, decodeFlags(), MemPage::hdrOffset, BtShared::mutex, BtShared::pageSize, MemPage::pBt, MemPage::pDbPage, MemPage::pgno, PTF_LEAF, put2byte, sqlite3_mutex_held, sqlite3PagerGetData(), sqlite3PagerGetExtra(), and BtShared::usableSize.
Referenced by balance_deeper(), balance_nonroot(), balance_quick(), balance_shallower(), btreeCreateTable(), btreeDropTable(), clearDatabasePage(), and newDatabase().
BtShared* SQLITE_WSD sqlite3SharedCacheList = 0 [static] |
Definition at line 63 of file btree.c.
Referenced by removeFromSharingList(), and sqlite3BtreeOpen().
const char zMagicHeader[] = SQLITE_FILE_HEADER [static] |
Definition at line 24 of file btree.c.
Referenced by lockBtree(), and newDatabase().
ContextLogger2—ContextLogger2 Logger Daemon Internals—Generated on Mon May 2 13:49:58 2011 by Doxygen 1.6.1