Home | History | Annotate | Download | only in dist

Lines Matching refs:Btree

7409 ** Defer sourcing vdbe.h and btree.h until after the "u8" and 
7413 /************** Include btree.h in the middle of sqliteInt.h *****************/
7414 /************** Begin file btree.h *******************************************/
7453 typedef struct Btree Btree;
7466 Btree *aBtree[SQLITE_MAX_ATTACHED+1];
7473 Btree **ppBtree, /* Return open Btree* here */
7490 SQLITE_PRIVATE int sqlite3BtreeClose(Btree*);
7491 SQLITE_PRIVATE int sqlite3BtreeSetCacheSize(Btree*,int);
7492 SQLITE_PRIVATE int sqlite3BtreeSetSafetyLevel(Btree*,int,int,int);
7493 SQLITE_PRIVATE int sqlite3BtreeSyncDisabled(Btree*);
7494 SQLITE_PRIVATE int sqlite3BtreeSetPageSize(Btree *p, int nPagesize, int nReserve, int eFix);
7495 SQLITE_PRIVATE int sqlite3BtreeGetPageSize(Btree*);
7496 SQLITE_PRIVATE int sqlite3BtreeMaxPageCount(Btree*,int);
7497 SQLITE_PRIVATE u32 sqlite3BtreeLastPage(Btree*);
7498 SQLITE_PRIVATE int sqlite3BtreeSecureDelete(Btree*,int);
7499 SQLITE_PRIVATE int sqlite3BtreeGetReserve(Btree*);
7500 SQLITE_PRIVATE int sqlite3BtreeSetAutoVacuum(Btree *, int);
7501 SQLITE_PRIVATE int sqlite3BtreeGetAutoVacuum(Btree *);
7502 SQLITE_PRIVATE int sqlite3BtreeBeginTrans(Btree*,int);
7503 SQLITE_PRIVATE int sqlite3BtreeCommitPhaseOne(Btree*, const char *zMaster);
7504 SQLITE_PRIVATE int sqlite3BtreeCommitPhaseTwo(Btree*);
7505 SQLITE_PRIVATE int sqlite3BtreeCommit(Btree*);
7506 SQLITE_PRIVATE int sqlite3BtreeRollback(Btree*);
7507 SQLITE_PRIVATE int sqlite3BtreeBeginStmt(Btree*,int);
7508 SQLITE_PRIVATE int sqlite3BtreeCreateTable(Btree*, int*, int flags);
7509 SQLITE_PRIVATE int sqlite3BtreeIsInTrans(Btree*);
7510 SQLITE_PRIVATE int sqlite3BtreeIsInReadTrans(Btree*);
7511 SQLITE_PRIVATE int sqlite3BtreeIsInBackup(Btree*);
7512 SQLITE_PRIVATE void *sqlite3BtreeSchema(Btree *, int, void(*)(void *));
7513 SQLITE_PRIVATE int sqlite3BtreeSchemaLocked(Btree *pBtree);
7514 SQLITE_PRIVATE int sqlite3BtreeLockTable(Btree *pBtree, int iTab, u8 isWriteLock);
7515 SQLITE_PRIVATE int sqlite3BtreeSavepoint(Btree *, int, int);
7517 SQLITE_PRIVATE const char *sqlite3BtreeGetFilename(Btree *);
7518 SQLITE_PRIVATE const char *sqlite3BtreeGetJournalname(Btree *);
7519 SQLITE_PRIVATE int sqlite3BtreeCopyFile(Btree *, Btree *);
7521 SQLITE_PRIVATE int sqlite3BtreeIncrVacuum(Btree *);
7536 SQLITE_PRIVATE int sqlite3BtreeDropTable(Btree*, int, int*);
7537 SQLITE_PRIVATE int sqlite3BtreeClearTable(Btree*, int, int*);
7538 SQLITE_PRIVATE void sqlite3BtreeTripAllCursors(Btree*, int);
7540 SQLITE_PRIVATE void sqlite3BtreeGetMeta(Btree *pBtree, int idx, u32 *pValue);
7541 SQLITE_PRIVATE int sqlite3BtreeUpdateMeta(Btree*, int idx, u32 value);
7565 Btree*, /* BTree containing table to open */
7601 SQLITE_PRIVATE char *sqlite3BtreeIntegrityCheck(Btree*, int *aRoot, int nRoot, int, int*);
7602 SQLITE_PRIVATE struct Pager *sqlite3BtreePager(Btree*);
7608 SQLITE_PRIVATE int sqlite3BtreeSetVersion(Btree *pBt, int iVersion);
7620 SQLITE_PRIVATE void sqlite3BtreeCursorList(Btree*);
7624 SQLITE_PRIVATE int sqlite3BtreeCheckpoint(Btree*);
7633 SQLITE_PRIVATE void sqlite3BtreeEnter(Btree*);
7641 SQLITE_PRIVATE void sqlite3BtreeLeave(Btree*);
7647 SQLITE_PRIVATE void sqlite3BtreeMutexArrayInsert(BtreeMutexArray*, Btree*);
7650 SQLITE_PRIVATE int sqlite3BtreeHoldsMutex(Btree*);
7670 /************** End of btree.h ***********************************************/
8151 ** NOTE: These values must match the corresponding BTREE_ values in btree.h.
8810 Btree *pBt; /* The B*Tree structure for this database file */
9386 ** Table.tnum is the page number for the root BTree page of the table in the
9403 int tnum; /* Root BTree node for this table (see note above) */
11103 SQLITE_PRIVATE Schema *sqlite3SchemaGet(sqlite3 *, Btree *);
12004 ** A cursor is a pointer into a single BTree within a database file.
12005 ** The cursor can seek to a BTree entry with a particular key, or
12006 ** loop over all entries of the Btree. You can also insert new BTree
12032 Btree *pBt; /* Separate file holding temporary table */
12303 BtreeMutexArray aMutex; /* An array of Btree used here and needing locks */
12529 Btree *pBt = db->aDb[i].pBt;
35368 ** 28 of the database header by the btree). If the size of the file
38381 /* This routine is only called by btree immediately after creating
44371 ** This file contains code used to implement mutexes on Btree objects.
44372 ** This code really belongs in btree.c. But btree.c is getting too
44413 ** BTrees. Each BTree is identified by the index of its root page. The
44427 ** Each page can be either a btree page, a freelist page, an overflow
44430 ** The first page is always a btree page. The first 100 bytes of the first
44482 ** Each btree pages is divided into three sections: The header, the
44512 ** The flags define the format of this btree page. The leaf flag means that
44563 ** bytes of key and data in a btree cell.
44628 ** first byte of on-disk image of every BTree page.
44641 ** walk up the BTree from any leaf to the root. Care must be taken to
44684 ** a btree handle is closed.
44687 Btree *pBtree; /* Btree handle holding this lock */
44697 /* A Btree handle
44714 ** in the referenced BtShared that point back to this Btree since those
44715 ** cursors have to do go through this Btree to find their BtShared and
44718 struct Btree {
44719 sqlite3 *db; /* The database connection holding this btree */
44720 BtShared *pBt; /* Sharable content of this btree */
44725 int nBackup; /* Number of backup operations reading this btree */
44726 Btree *pNext; /* List of other sharable Btrees from the same db */
44727 Btree *pPrev; /* Back pointer of the same list */
44734 ** Btree.inTrans may take one of the following values.
44737 ** of the Btree structure. At most one of these may open a write transaction,
44750 ** private Btree object for the file and each of those Btrees points
44781 sqlite3 *db; /* Database connection currently using this Btree */
44810 BtLock *pLock; /* List of locks held on this shared-btree struct */
44811 Btree *pWriter; /* Btree with currently open write transaction */
44861 Btree *pBtree; /* The Btree to which this cursor belongs */
44966 ** PTRMAP_BTREE: The database page is a non-root btree page. The page number
44967 ** identifies the parent page in the btree.
44976 ** of handle p (type Btree*) are internally consistent.
45031 static void lockBtreeMutex(Btree *p){
45045 static void unlockBtreeMutex(Btree *p){
45056 ** Enter a mutex on the given BTree object.
45060 ** But we keep a reference count in Btree.wantToLock so the behavior
45065 ** Btrees belonging to the same database connection as the p Btree
45071 SQLITE_PRIVATE void sqlite3BtreeEnter(Btree *p){
45072 Btree *pLater;
45074 /* Some basic sanity checking on the Btree. The list of Btrees
45076 ** Btree.pBt value. All elements of the list should belong to
45131 ** Exit the recursive mutex on a Btree.
45133 SQLITE_PRIVATE void sqlite3BtreeLeave(Btree *p){
45145 ** Return true if the BtShared mutex is held on the btree, or if the
45150 SQLITE_PRIVATE int sqlite3BtreeHoldsMutex(Btree *p){
45163 ** Enter and leave a mutex on a Btree given a cursor owned by that
45164 ** Btree. These entry points are used by incremental I/O and can be
45177 ** Enter the mutex on every Btree associated with a database
45192 Btree *p, *pLater;
45202 /* Reason for ALWAYS: There must be at least on unlocked Btree in
45220 Btree *p;
45247 Btree *p;
45259 ** Add a new Btree pointer to a BtreeMutexArray.
45271 SQLITE_PRIVATE void sqlite3BtreeMutexArrayInsert(BtreeMutexArray *pArray, Btree *pBtree){
45300 ** Enter the mutex of every btree in the array. This routine is
45307 Btree *p = pArray->aBtree[i];
45315 /* The Btree is sharable because only sharable Btrees are entered
45327 ** Leave the mutex of every btree in the group.
45332 Btree *p = pArray->aBtree[i];
45349 SQLITE_PRIVATE void sqlite3BtreeEnter(Btree *p){
45355 Btree *p = db->aDb[i].pBt;
45365 /************** Begin file btree.c *******************************************/
45404 ** from the header of a btree page. If the page size is 65536 and the page
45470 ** Btree connection pBtree:
45486 Btree *pBtree, /* Handle that must hold lock */
45555 ** It is illegal for pBtree to write if some other Btree object that
45557 ** the iRoot table. Except, if the other Btree object has the
45566 static int hasReadConflicts(Btree *pBtree, Pgno iRoot){
45581 ** Query to see if Btree handle p may obtain a lock of type eLock
45586 static int querySharedCacheTableLock(Btree *p, Pgno iTab, u8 eLock){
45595 /* If requesting a write-lock, then the Btree must have an open write
45642 ** Add a lock on the table with root-page iTable to the shared-btree used
45643 ** by Btree handle p. Parameter eLock must be either READ_LOCK or
45648 ** (a) The specified Btree object p is connected to a sharable
45651 ** (b) No other Btree objects hold a lock that conflicts
45658 static int setSharedCacheTableLock(Btree *p, Pgno iTable, u8 eLock){
45686 /* If the above search did not find a BtLock struct associating Btree p
45716 ** the setSharedCacheTableLock() procedure) held by Btree object p.
45718 ** This function assumes that Btree p has an open read or write
45722 static void clearAllSharedCacheTableLocks(Btree *p){
45751 /* This function is called when Btree p is concluding its
45765 ** This function changes all write-locks held by Btree p into read-locks.
45767 static void downgradeAllSharedCacheTableLocks(Btree *p){
45809 ** on the shared btree structure pBt.
45833 Btree *pBtree, /* The database file to check */
46014 BtCursor *pCur, /* Cursor open on the btree to be searched */
46015 const void *pKey, /* Packed key if the btree is an index */
46210 ** Given a btree page and a cell index (0 means the first cell on
46333 ** data area of the btree-page. The return number includes the cell
46752 BtShared *pBt; /* The main btree structure */
46883 ** the btree layer.
46907 BtShared *pBt, /* The btree */
46944 SQLITE_PRIVATE u32 sqlite3BtreeLastPage(Btree *p){
47014 /* pPage might not be a btree page; it might be an overflow page
47018 ** btreeInitPage() be called on every btree page so we make
47026 ** Invoke the busy handler for a btree.
47060 const char *zFilename, /* Name of the file containing the BTree database */
47062 Btree **ppBtree, /* Pointer to new Btree object written here */
47066 sqlite3_vfs *pVfs; /* The VFS to use for this btree */
47067 BtShared *pBt = 0; /* Shared part of btree structure */
47068 Btree *p; /* Handle to return */
47107 p = sqlite3MallocZero(sizeof(Btree));
47120 ** If this Btree is a candidate for shared cache, try to find an
47144 Btree *pExisting = db->aDb[iDb].pBt;
47175 ** The following asserts make sure that structures used by the btree are
47263 /* If the new Btree uses a sharable pBtShared, then link the new
47264 ** Btree into the list of all sharable Btrees for the same connection.
47269 Btree *pSib;
47380 SQLITE_PRIVATE int sqlite3BtreeClose(Btree *p){
47403 /* If there are still other outstanding references to the shared-btree
47405 ** up the shared-btree.
47450 SQLITE_PRIVATE int sqlite3BtreeSetCacheSize(Btree *p, int mxPage){
47469 Btree *p, /* The btree to set the safety level on */
47485 ** Return TRUE if the given btree is set to safety level 1. In other
47488 SQLITE_PRIVATE int sqlite3BtreeSyncDisabled(Btree *p){
47520 SQLITE_PRIVATE int sqlite3BtreeSetPageSize(Btree *p, int pageSize, int nReserve, int iFix){
47550 SQLITE_PRIVATE int sqlite3BtreeGetPageSize(Btree *p){
47559 SQLITE_PRIVATE int sqlite3BtreeGetReserve(Btree *p){
47572 SQLITE_PRIVATE int sqlite3BtreeMaxPageCount(Btree *p, int mxPage){
47585 SQLITE_PRIVATE int sqlite3BtreeSecureDelete(Btree *p, int newFlag){
47604 SQLITE_PRIVATE int sqlite3BtreeSetAutoVacuum(Btree *p, int autoVacuum){
47628 SQLITE_PRIVATE int sqlite3BtreeGetAutoVacuum(Btree *p){
47895 SQLITE_PRIVATE int sqlite3BtreeBeginTrans(Btree *p, int wrflag){
47903 /* If the btree is already in a write-transaction, or it
47919 ** on this shared-btree structure and a second write transaction is
48076 ** PTRMAP_BTREE: pPage is a btree-page. The pointer points at a child
48079 ** PTRMAP_OVERFLOW1: pPage is a btree-page. The pointer points at an overflow
48145 BtShared *pBt, /* Btree */
48171 /* If pDbPage was a btree-page, then it may have child pages and/or cells
48347 SQLITE_PRIVATE int sqlite3BtreeIncrVacuum(Btree *p){
48452 ** Otherwise, sync the database file for the btree pBt. zMaster points to
48463 SQLITE_PRIVATE int sqlite3BtreeCommitPhaseOne(Btree *p, const char *zMaster){
48487 static void btreeEndTransaction(Btree *p){
48500 ** transaction count of the shared btree. If the transaction count
48535 SQLITE_PRIVATE int sqlite3BtreeCommitPhaseTwo(Btree *p){
48565 SQLITE_PRIVATE int sqlite3BtreeCommit(Btree *p){
48608 ** to prevent them from trying to use the btree after
48614 SQLITE_PRIVATE void sqlite3BtreeTripAllCursors(Btree *pBtree, int errCode){
48639 SQLITE_PRIVATE int sqlite3BtreeRollback(Btree *p){
48707 SQLITE_PRIVATE int sqlite3BtreeBeginStmt(Btree *p, int iStatement){
48738 SQLITE_PRIVATE int sqlite3BtreeSavepoint(Btree *p, int op, int iSavepoint){
48762 ** Create a new cursor for the BTree whose root is on the page
48794 Btree *p, /* The btree */
48842 Btree *p, /* The btree */
48886 ** A btree will work fine with zero or negative rowids. We just cannot
48914 Btree *pBtree = pCur->pBtree;
49190 MemPage *pPage = pCur->apPage[pCur->iPage]; /* Btree page of current entry */
49191 BtShared *pBt = pCur->pBt; /* Btree this cursor belongs to */
49209 /* Check if data must be read/written to/from the btree page itself. */
49377 ** any btree routine is called.
49423 ** or be destroyed on the next call to any Btree routine,
49554 Btree *p = pCur->pBtree;
51818 BtShared *pBt = pRoot->pBt; /* The BTree */
51982 ** Insert a new record into the BTree. The key is given by (pKey,nKey)
52016 Btree *p = pCur->pBtree;
52146 Btree *p = pCur->pBtree;
52258 ** Create a new BTree table. Write into *piTable the page
52268 static int btreeCreateTable(Btree *p, int *piTable, int createTabFlags){
52403 SQLITE_PRIVATE int sqlite3BtreeCreateTable(Btree *p, int *piTable, int flags){
52416 BtShared *pBt, /* The BTree that contains the table */
52473 SQLITE_PRIVATE int sqlite3BtreeClearTable(Btree *p, int iTable, int *pnChange){
52512 static int btreeDropTable(Btree *p, Pgno iTable, int *piMoved){
52615 SQLITE_PRIVATE int sqlite3BtreeDropTable(Btree *p, int iTable, int *piMoved){
52637 SQLITE_PRIVATE void sqlite3BtreeGetMeta(Btree *p, int idx, u32 *pMeta){
52661 SQLITE_PRIVATE int sqlite3BtreeUpdateMeta(Btree *p, int idx, u32 iMeta){
52756 ** Return the pager associated with a BTree. This routine is used for
52759 SQLITE_PRIVATE Pager *sqlite3BtreePager(Btree *p){
53148 ** This routine does a complete check of the given BTree file. aRoot[] is
53161 Btree *p, /* The btree to be checked */
53272 SQLITE_PRIVATE const char *sqlite3BtreeGetFilename(Btree *p){
53285 SQLITE_PRIVATE const char *sqlite3BtreeGetJournalname(Btree *p){
53293 SQLITE_PRIVATE int sqlite3BtreeIsInTrans(Btree *p){
53300 ** Run a checkpoint on the Btree passed as the first argument.
53303 ** transaction on the shared-cache the argument Btree is connected to.
53305 SQLITE_PRIVATE int sqlite3BtreeCheckpoint(Btree *p){
53324 SQLITE_PRIVATE int sqlite3BtreeIsInReadTrans(Btree *p){
53330 SQLITE_PRIVATE int sqlite3BtreeIsInBackup(Btree *p){
53338 ** a single shared-btree. The memory is used by client code for its own
53340 ** the shared-btree). The btree layer manages reference counting issues.
53342 ** The first time this is called on a shared-btree, nBytes bytes of memory
53351 ** Just before the shared-btree is closed, the function passed as the
53354 ** on the memory, the btree layer does that.
53356 SQLITE_PRIVATE void *sqlite3BtreeSchema(Btree *p, int nBytes, void(*xFree)(void *)){
53369 ** btree as the argument handle holds an exclusive lock on the
53372 SQLITE_PRIVATE int sqlite3BtreeSchemaLocked(Btree *p){
53389 SQLITE_PRIVATE int sqlite3BtreeLockTable(Btree *p, int iTab, u8 isWriteLock){
53475 SQLITE_PRIVATE int sqlite3BtreeSetVersion(Btree *pBtree, int iVersion){
53506 /************** End of btree.c ***********************************************/
53534 Btree *pDest; /* Destination b-tree file */
53540 Btree *pSrc; /* Source b-tree file */
53579 ** the Btree objects may have their own mutexes that require locking.
53593 static Btree *findBtree(sqlite3 *pErrorDb, sqlite3 *pDb, const char *zDb){
53757 ** Then clear the Btree layer MemPage.isInit flag. Both this module
53759 ** of the page 'extra' space to invalidate the Btree layers
53979 ** no need to check the return values of the btree methods here, as
54031 /* If a transaction is still open on the Btree, roll it back. */
54127 SQLITE_PRIVATE int sqlite3BtreeCopyFile(Btree *pTo, Btree *pFrom){
54362 ** sqlite3_value_text()), or for ensuring that values to be used as btree
55051 ** Move data out of a btree
55067 int key, /* If true, retrieve from the btree key, not data. */
55070 char *zData; /* Data from the btree layer */
55071 int available = 0; /* Number of bytes available on the local btree page */
56260 ** Declare to the Vdbe that the BTree object at db->aDb[i] is used.
56262 ** The prepared statement has to know in advance which Btree objects
56975 Btree *pBt = db->aDb[i].pBt;
57007 Btree *pBt = db->aDb[i].pBt;
57019 Btree *pBt = db->aDb[i].pBt;
57073 Btree *pBt = db->aDb[i].pBt;
57118 Btree *pBt = db->aDb[i].pBt;
57151 Btree *pBt = db->aDb[i].pBt;
57196 ** For every Btree that in database connection db which
57198 ** that Btree might have been modified so that the cursor
57214 Btree *p = db->aDb[i].pBt;
57250 Btree *pBt = db->aDb[i].pBt;
58795 Btree *pBt = db->aDb[i].pBt;
60658 BtCursor *pCrsr; /* The BTree cursor */
60716 Btree *pBt;
60728 Btree *pBt;
60736 Btree *pX;
60920 Btree *pBt; /* Btree to change journal mode of */
60927 Btree *pBt;
62496 BtCursor *pCrsr; /* The BTree cursor */
63116 ** back any currently active btree transactions. If there are any active
63219 Btree *pBt;
63347 Btree *pBt;
63440 Btree *pX;
63512 ** since moved into the btree layer. */
63526 ** The cursor points to a BTree table if P4==0 and to a BTree index
63875 ** Cursor P1 is on an index btree. If the record identified by P3 and P4
63885 ** Cursor P1 is on an index btree. If the record identified by P3 and P4
63957 ** Cursor P1 is open on an index b-tree - that is to say, a btree which
65763 Btree *pBt; /* Btree to change journal mode of */
65895 Btree *pBt;
66340 Btree *pBt;
66619 /* This VDBE program seeks a btree cursor to the identified
74188 /* Open the database file. If the btree
76677 ** used by SQLite when the btree layer moves a table root page. The
76717 ** if a root-page of another table is moved by the btree-layer whilst
76745 ** in case a root-page belonging to another table is moved by the btree layer
76918 ** at the btree level, in case the sqlite_sequence table needs to
77125 int iTab = pParse->nTab++; /* Btree cursor used for pTab */
77126 int iIdx = pParse->nTab++; /* Btree cursor used for pIndex */
78245 Btree *pBt;
78983 ** Find and return the schema associated with a BTree. Create
78986 SQLITE_PRIVATE Schema *sqlite3SchemaGet(sqlite3 *db, Btree *pBt){
85883 Btree *pBt = pDb->pBt;
85908 Btree *pBt = pDb->pBt;
86077 Btree *pBt = pDb->pBt;
86906 Btree *pBt;
87440 Btree *pBt = db->aDb[iDb].pBt; /* Btree database to read cookie from */
87554 Btree *pBt = db->aDb[i].pBt;
93609 ** command. If the latter, then the row-records in the table btree on disk
94336 Btree *pMain; /* The database being vacuumed */
94337 Btree *pTemp; /* The temporary database we vacuum into */
94507 ** Open a btree level transaction on the main database. This allows a
94508 ** call to sqlite3BtreeCopyFile(). The main database btree level
94533 /* Copy Btree meta values */
94564 ** was committed at the btree level). So it safe to end the transaction
99532 ** There are Btree cursors associated with each table. t1 uses cursor
105496 Btree *pBt = db->aDb[j].pBt;
107185 Btree *pBtree = db->aDb[iDb].pBt;