Lines Matching defs:btree

14844 ** Defer sourcing vdbe.h and btree.h until after the "u8" and
15226 ** NOTE: These values must match the corresponding BTREE_ values in btree.h.
15421 /************** Include btree.h in the middle of sqliteInt.h *****************/
15422 /************** Begin file btree.h *******************************************/
15694 ** entry in either an index or table btree.
15838 /************** End of btree.h ***********************************************/
17202 #define SQLITE_CellSizeCk 0x00200000 /* Check btree cell sizes on load */
18004 ** or greater than a key in the btree, respectively. These are normally
22527 Pgno pgnoRoot; /* Root page of the open btree cursor */
52628 ** btree layer only operates on the cached copy of the database pages.
53561 ** is the extension added by the btree.c module containing information such
53579 ** allocations. However, the btree layer needs a small (16-byte) overrun
53588 ** The btree.c module deals with pointers to MemPage objects.
56049 ** 28 of the database header by the btree). If the size of the file
59401 /* This routine is only called by btree immediately after creating
60227 ** (The extra space is used by btree as the MemPage object.)
60604 /* pPager->szMmap = SQLITE_DEFAULT_MMAP_SIZE // will be set by btree.c */
61284 ** The btree layer always holds page1 open until the end, so these first
67561 ** This code really belongs in btree.c. But btree.c is getting too
67616 ** Each page can be either a btree page, a freelist page, an overflow
67619 ** The first page is always a btree page. The first 100 bytes of the first
67672 ** Each btree pages is divided into three sections: The header, the
67702 ** The flags define the format of this btree page. The leaf flag means that
67753 ** bytes of key and data in a btree cell.
67877 ** a btree handle is closed.
67912 sqlite3 *db; /* The database connection holding this btree */
67913 BtShared *pBt; /* Sharable content of this btree */
67919 int nBackup; /* Number of backup operations reading this btree */
68021 BtLock *pLock; /* List of locks held on this shared-btree struct */
68127 #define BTCF_Multiple 0x20 /* Maybe another cursor on the same btree */
68218 ** PTRMAP_BTREE: The database page is a non-root btree page. The page number
68219 ** identifies the parent page in the btree.
68287 ** cell addresses in a btree header.
68438 ** Return true if the BtShared mutex is held on the btree, or if the
68553 ** are null #defines in btree.h.
68555 ** If shared cache is disabled, then all btree mutex routines, including
68556 ** the ones below, are no-ops and are null #defines in btree.h.
68594 /************** Begin file btree.c *******************************************/
68634 ** from the header of a btree page. If the page size is 65536 and the page
68962 ** Add a lock on the table with root-page iTable to the shared-btree used
69120 ** statements only and for the purpose of double-checking that the btree code
69131 ** on the shared btree structure pBt.
69137 ** on the shared btree structure pBt.
69291 /* Only the rowid is required for a table btree */
69294 /* For an index btree, save the complete key content. It is possible
69358 ** the location in the btree is remembered in such a way that it can be
69359 ** moved back to the same spot after the btree has been modified. This
69363 ** If there are two or more cursors on the same btree, then all such
69431 BtCursor *pCur, /* Cursor open on the btree to be searched */
69432 const void *pKey, /* Packed key if the btree is an index */
69501 ** from under them, for example. Cursor might also move if a btree
69530 ** has been moved by some outside activity (such as a btree rebalance or
69640 ** as a btree page. */
69710 ** Given a btree page and a cell index (0 means the first cell on
69763 ** Given a record with nPayload bytes of payload stored within btree
69786 ** btreeParseCellPtr() => table btree leaf nodes
69787 ** btreeParseCellNoPayload() => table btree internal nodes
69788 ** btreeParseCellPtrIndex() => index btree nodes
69943 ** data area of the btree-page. The return number includes the cell
70727 BtShared *pBt; /* The main btree structure */
70813 ** the btree layer.
70840 BtShared *pBt, /* The btree */
70988 BtShared *pBt, /* The btree */
71024 /* pPage might not be a btree page; it might be an overflow page
71028 ** btreeInitPage() be called on every btree page so we make
71037 ** Invoke the busy handler for a btree.
71078 BtShared *pBt = 0; /* Shared part of btree structure */
71202 ** The following asserts make sure that structures used by the btree are
71482 /* If there are still other outstanding references to the shared-btree
71484 ** up the shared-btree.
71575 Btree *p, /* The btree to set the safety level on */
72135 /* If the btree is already in a write-transaction, or it
72160 ** on this shared-btree structure and a second write transaction is
72343 ** PTRMAP_BTREE: pPage is a btree-page. The pointer points at a child
72346 ** PTRMAP_OVERFLOW1: pPage is a btree-page. The pointer points at an overflow
72444 /* If pDbPage was a btree-page, then it may have child pages and/or cells
72774 ** Otherwise, sync the database file for the btree pBt. zSuperJrnl points to
72828 ** transaction count of the shared btree. If the transaction count
73162 Btree *p, /* The btree */
73208 /* If there are two or more cursors on the same btree, then all such
73229 Btree *p, /* The btree */
73242 Btree *p, /* The btree */
73369 ** Return the value of the integer key or "rowid" for a table btree.
73371 ** ordinary table btree. If the cursor points to an index btree or
73618 /* Check if data must be read/written to/from the btree page itself. */
73773 ** If pointing to a table btree, then the content section is read. If
73838 ** any btree routine is called.
74696 ** is a hint to the implement. SQLite btree implementation does not use
74789 ** hint to the implement. The native SQLite btree implementation does not
74880 BtShared *pBt, /* The btree */
75482 /* This is the common case where everything fits on the btree page
75752 ** a btree page has a value of 3 or less, the pCell value might point
75828 ** The order of cells is in the array is for an index btree is:
75836 ** For a table-btree (with rowids) the items 2 and 4 are empty because
75839 ** For an index btree, the apEnd[] array holds pointer to the end of page
75850 ** For a table-btree, the concept is similar, except only apEnd[0]..apEnd[2]
76710 ** offset section of the btree page will be overwritten and we will no
77604 ** For a table btree (used for rowid tables), only the pX.nKey value of
77609 ** For an index btree (used for indexes and WITHOUT ROWID tables), the
78979 ** entry represents the span of a cell or freeblock on a btree page.
79308 Btree *p, /* The btree to be checked */
79524 ** a single shared-btree. The memory is used by client code for its own
79526 ** the shared-btree). The btree layer manages reference counting issues.
79528 ** The first time this is called on a shared-btree, nBytes bytes of memory
79537 ** Just before the shared-btree is closed, the function passed as the
79540 ** on the memory, the btree layer does that.
79555 ** btree as the argument handle holds an exclusive lock on the
79745 /************** End of btree.c ***********************************************/
80319 ** no need to check the return values of the btree methods here, as
80964 ** sqlite3_value_text()), or for ensuring that values to be used as btree
81781 ** Move data out of a btree key or data field and into a Mem structure.
81787 ** pMem->zMalloc to hold the content from the btree, if possible. New
81823 u32 available = 0; /* Number of bytes available on the local btree page */
86186 ** pointed to was deleted out from under it. Or maybe the btree was
92973 ** Jump to P2 if the type of a column in a btree is one of the types specified
92976 ** P1 is normally a cursor on a btree for which the row decode cache is
92980 ** The the btree row has fewer than P3 columns, then use P4 as the
93951 ** every btree page of the table. But if P3 is non-zero, an estimate
94164 ** back any currently active btree transactions. If there are any active
94509 ** and subsequently delete entries in an index btree. This is a
94615 ** since moved into the btree layer. */
94683 ** in btree.h. These flags control aspects of the operation of
94684 ** the btree. The BTREE_OMIT_JOURNAL and BTREE_SINGLE flags are
94903 ** OPFLAG_SEEKEQ flags is a hint to the btree layer to say that this
94970 ** OPFLAG_SEEKEQ flags is a hint to the btree layer to say that this
95191 ** unnecessary seeks on the btree, substituting steps to the next row
95237 ** btree) then jump to SeekGE.P2, ending the loop.
95240 ** (indicating that the target row does not exist in the btree) then
95415 ** Cursor P1 is on an index btree. If the record identified by P3 and P4
95432 ** Cursor P1 is on an index btree. If the record identified by P3 and P4
95448 ** record. Cursor P1 is an index btree. P2 is a jump destination.
95482 ** Cursor P1 is on an index btree. If the record identified by P3 and P4
95485 ** P1 index btree has a matching key prefix. If there are no matches, jump
95600 ** P1 is the index of a cursor open on an SQL table btree (with integer
95624 ** P1 is the index of a cursor open on an SQL table btree (with integer
96371 ** Position cursor P1 at the end of the btree for the purpose of
96372 ** appending a new entry onto the btree.
96376 ** at the end of the btree and so no changes are made to
96543 ** The P3 value is a hint to the btree implementation. If P3==1, that
96568 ** The P3 value is a hint to the btree implementation. If P3==1, that
97042 /* All OP_Destroy operations occur on the same btree */
97170 ** on every btree. This is a prerequisite for invoking
98217 ** Lock the btree to which cursor P1 is pointing so that the btree cannot be
98232 ** Unlock the btree to which cursor P1 is pointing so that it can be
99507 /* This VDBE program seeks a btree cursor to the identified
116699 /* Open the database file. If the btree is successfully opened, use
119893 /* Bypass the creation of the PRIMARY KEY btree and the sqlite_schema
120675 ** used by SQLite when the btree layer moves a table root page. The
120718 ** if a root-page of another table is moved by the btree-layer whilst
120748 ** in case a root-page belonging to another table is moved by the btree layer
120854 ** at the btree level, in case the sqlite_sequence table needs to
124396 ** 1. iDataCur is an open cursor on the btree that is the canonical data
124571 ** btree for the table pTab. (This will be either the table itself
131167 u8 pik_flags; /* flag values passed to the btree insert */
131572 return 0; /* Corrupt schema - two indexes on the same btree */
147879 ** command. If the latter, then the row-records in the table btree on disk
148144 int iDataCur; /* Cursor for the canonical data btree */
149913 ** was committed at the btree level). So it safe to end the transaction
151446 struct { /* Information for internal btree tables */
151452 } btree;
151926 #define WHERE_INDEXED 0x00000200 /* WhereLoop.u.btree.pIndex is valid */
152014 Index *pIndex = pLoop->u.btree.pIndex;
152015 u16 nEq = pLoop->u.btree.nEq;
152029 explainAppendTerm(pStr, pIndex, pLoop->u.btree.nBtm, j, i, ">");
152033 explainAppendTerm(pStr, pIndex, pLoop->u.btree.nTop, j, i, "<");
152073 || ((flags&WHERE_VIRTUALTABLE)==0 && (pLoop->u.btree.nEq>0))
152083 assert( pLoop->u.btree.pIndex!=0 );
152084 pIdx = pLoop->u.btree.pIndex;
152189 for(i=pLoop->nSkip; i<pLoop->u.btree.nEq; i++){
152190 const char *z = explainIndexColumnName(pLoop->u.btree.pIndex, i);
152221 if( (pLoop->wsFlags & WHERE_VIRTUALTABLE)==0 && pLoop->u.btree.pIndex!=0 ){
152222 zObj = pLoop->u.btree.pIndex->zName;
152515 && pLoop->u.btree.pIndex!=0
152516 && pLoop->u.btree.pIndex->aSortOrder[iEq]
152709 nEq = pLoop->u.btree.nEq;
152711 pIdx = pLoop->u.btree.pIndex;
152717 nReg = pLoop->u.btree.nEq + nExtraReg;
152967 sHint.pIdx = pLoop->u.btree.pIndex;
153016 if( pLoop->u.btree.nEq==0 && pTerm!=pEndRange ){
153220 u16 nEq = pLoop->u.btree.nEq;
153467 assert( pLoop->u.btree.nEq==1 );
153643 u16 nEq = pLoop->u.btree.nEq; /* Number of == or IN terms */
153644 u16 nBtm = pLoop->u.btree.nBtm; /* Length of BTM vector */
153645 u16 nTop = pLoop->u.btree.nTop; /* Length of TOP vector */
153664 pIdx = pLoop->u.btree.pIndex;
153674 nExtraReg = MAX(nExtraReg, pLoop->u.btree.nBtm);
153681 nExtraReg = MAX(nExtraReg, pLoop->u.btree.nTop);
153826 ** on the estimated number of rows in the btree seems like a good
154297 && (ii==0 || pSubLoop->u.btree.pIndex==pCov)
154298 && (HasRowid(pTab) || !IsPrimaryKeyIndex(pSubLoop->u.btree.pIndex))
154301 pCov = pSubLoop->u.btree.pIndex;
157449 pLoop->u.btree.nEq = pLoop->nLTerm = nKeyCol;
157475 pLoop->u.btree.pIndex = pIdx;
157500 assert( (u32)n==pLoop->u.btree.nEq );
157556 regBase, pLoop->u.btree.nEq);
157670 Index *pIdx = pLoop->u.btree.pIndex;
157671 int n = pLoop->u.btree.nEq;
158246 Index *p = pLoop->u.btree.pIndex;
158247 int nEq = pLoop->u.btree.nEq;
158326 ** The value in (pBuilder->pNew->u.btree.nEq) is the number of the index
158363 Index *p = pLoop->u.btree.pIndex;
158364 int nEq = pLoop->u.btree.nEq;
158372 int nBtm = pLoop->u.btree.nBtm;
158373 int nTop = pLoop->u.btree.nTop;
158538 Index *p = pBuilder->pNew->u.btree.pIndex;
158539 int nEq = pBuilder->pNew->u.btree.nEq;
158602 Index *p = pBuilder->pNew->u.btree.pIndex;
158703 if( p->u.btree.pIndex && (zName = p->u.btree.pIndex->zName)!=0 ){
158709 sqlite3DebugPrintf(".%-16s %2d", zName, p->u.btree.nEq);
158759 }else if( (p->wsFlags & WHERE_AUTO_INDEX)!=0 && p->u.btree.pIndex!=0 ){
158760 sqlite3DbFree(db, p->u.btree.pIndex->zColAff);
158761 sqlite3DbFreeNN(db, p->u.btree.pIndex);
158762 p->u.btree.pIndex = 0;
158814 pFrom->u.btree.pIndex = 0;
159134 Index *pIndex = p->u.btree.pIndex;
159136 p->u.btree.pIndex = 0;
159323 ** We have so far matched pBuilder->pNew->u.btree.nEq terms of the
159349 u16 saved_nEq; /* Original value of pNew->u.btree.nEq */
159350 u16 saved_nBtm; /* Original value of pNew->u.btree.nBtm */
159351 u16 saved_nTop; /* Original value of pNew->u.btree.nTop */
159364 pNew->u.btree.nEq, pNew->nSkip, pNew->rRun));
159371 assert( pNew->u.btree.nBtm==0 );
159376 assert( pNew->u.btree.nEq<pProbe->nColumn );
159377 assert( pNew->u.btree.nEq<pProbe->nKeyCol
159380 saved_nEq = pNew->u.btree.nEq;
159381 saved_nBtm = pNew->u.btree.nBtm;
159382 saved_nTop = pNew->u.btree.nTop;
159423 pNew->u.btree.nEq = saved_nEq;
159424 pNew->u.btree.nBtm = saved_nBtm;
159425 pNew->u.btree.nTop = saved_nTop;
159509 assert( saved_nEq==pNew->u.btree.nEq );
159532 pNew->u.btree.nBtm = nVecLen;
159545 pNew->u.btree.nTop = 1;
159552 pNew->u.btree.nTop = nVecLen;
159570 int nEq = ++pNew->u.btree.nEq;
159584 && ALWAYS(pNew->u.btree.nEq<=pProbe->nSampleCol)
159665 && pNew->u.btree.nEq<pProbe->nColumn
159666 && (pNew->u.btree.nEq<pProbe->nKeyCol ||
159677 pNew->u.btree.nEq = saved_nEq;
159678 pNew->u.btree.nBtm = saved_nBtm;
159679 pNew->u.btree.nTop = saved_nTop;
159706 pNew->u.btree.nEq++;
159717 pNew->u.btree.nEq = saved_nEq;
159934 SrcItem *pSrc; /* The FROM clause btree term to add */
160004 pNew->u.btree.nEq = 1;
160006 pNew->u.btree.pIndex = 0;
160053 pNew->u.btree.nEq = 0;
160054 pNew->u.btree.nBtm = 0;
160055 pNew->u.btree.nTop = 0;
160062 pNew->u.btree.pIndex = pProbe;
160990 pLoop->u.btree.nDistinctCol = 0;
161035 }else if( (pIndex = pLoop->u.btree.pIndex)==0 || pIndex->bUnordered ){
161059 assert( j>=pLoop->u.btree.nEq
161062 if( j<pLoop->u.btree.nEq && j>=pLoop->nSkip ){
161087 ** j<pLoop->u.btree.nEq constraint above. Any equality other
161091 for(i=j+1; i<pLoop->u.btree.nEq; i++){
161118 && j>=pLoop->u.btree.nEq
161154 pLoop->u.btree.nDistinctCol = j+1;
161175 if( j==pLoop->u.btree.nEq ){
161763 pLoop->u.btree.nEq = 1;
161788 pLoop->u.btree.nEq = j;
161789 pLoop->u.btree.pIndex = pIdx;
162588 if( pLoop->u.btree.pIndex!=0 ){
162603 Index *pIx = pLoop->u.btree.pIndex;
162842 && (pIdx = pLoop->u.btree.pIndex)->hasStat1
162843 && (n = pLoop->u.btree.nDistinctCol)>0
162931 VdbeComment((v, "next skip-scan on %s", pLoop->u.btree.pIndex->zName));
163014 pIdx = pLoop->u.btree.pIndex;
204176 /* Unable to write to the btree while another cursor is reading from it,
206946 /* Unable to write to the btree while another cursor is reading from it,
214213 ** The pager and btree modules arrange objects in memory so that there are
214275 /* Size information for a single cell within a btree page */
214285 /* Size information for a single btree page */
214317 int nPage; /* Number of pages in current btree */
214548 ** For a single cell on a btree page, compute the number of bytes of
214749 ** the next entry is the next btree.
214765 /* Start measuring space on the next btree */
214790 /* Continue analyzing the btree previously started */
214830 ** an entire btree, this is the exit point from this function */
214897 /* If computing aggregate space usage by btree, continue with the