Index: third_party/sqlite/src/src/btreeInt.h |
diff --git a/third_party/sqlite/src/src/btreeInt.h b/third_party/sqlite/src/src/btreeInt.h |
index 239439b4ad9e38288ec252e0d373a14b64749195..55469cff906b286083dfa71698106b096f93dea5 100644 |
--- a/third_party/sqlite/src/src/btreeInt.h |
+++ b/third_party/sqlite/src/src/btreeInt.h |
@@ -9,8 +9,6 @@ |
** May you share freely, never taking more than you give. |
** |
************************************************************************* |
-** $Id: btreeInt.h,v 1.52 2009/07/15 17:25:46 drh Exp $ |
-** |
** This file implements a external (disk-based) database using BTrees. |
** For a detailed discussion of BTrees, refer to |
** |
@@ -48,9 +46,9 @@ |
** |
** The file is divided into pages. The first page is called page 1, |
** the second is page 2, and so forth. A page number of zero indicates |
-** "no such page". The page size can be anything between 512 and 65536. |
-** Each page can be either a btree page, a freelist page or an overflow |
-** page. |
+** "no such page". The page size can be any power of 2 between 512 and 65536. |
+** Each page can be either a btree page, a freelist page, an overflow |
+** page, or a pointer-map page. |
** |
** The first page is always a btree page. The first 100 bytes of the first |
** page contain a special header (the "file header") that describes the file. |
@@ -220,7 +218,7 @@ |
/* The following value is the maximum cell size assuming a maximum page |
** size give above. |
*/ |
-#define MX_CELL_SIZE(pBt) (pBt->pageSize-8) |
+#define MX_CELL_SIZE(pBt) ((int)(pBt->pageSize-8)) |
/* The maximum number of cells on a single page of the database. This |
** assumes a minimum cell size of 6 bytes (4 bytes for the cell itself |
@@ -329,8 +327,8 @@ struct BtLock { |
** this structure. |
** |
** For some database files, the same underlying database cache might be |
-** shared between multiple connections. In that case, each contection |
-** has it own pointer to this object. But each instance of this object |
+** shared between multiple connections. In that case, each connection |
+** has it own instance of this object. But each instance of this object |
** points to the same BtShared object. The database cache and the |
** schema associated with the database file are all contained within |
** the BtShared object. |
@@ -338,7 +336,7 @@ struct BtLock { |
** All fields in this structure are accessed under sqlite3.mutex. |
** The pBt pointer itself may not be changed while there exists cursors |
** in the referenced BtShared that point back to this Btree since those |
-** cursors have to do go through this Btree to find their BtShared and |
+** cursors have to go through this Btree to find their BtShared and |
** they often do so without holding sqlite3.mutex. |
*/ |
struct Btree { |
@@ -409,21 +407,26 @@ struct BtShared { |
MemPage *pPage1; /* First page of the database */ |
u8 readOnly; /* True if the underlying file is readonly */ |
u8 pageSizeFixed; /* True if the page size can no longer be changed */ |
+ u8 secureDelete; /* True if secure_delete is enabled */ |
+ u8 initiallyEmpty; /* Database is empty at start of transaction */ |
+ u8 openFlags; /* Flags to sqlite3BtreeOpen() */ |
#ifndef SQLITE_OMIT_AUTOVACUUM |
u8 autoVacuum; /* True if auto-vacuum is enabled */ |
u8 incrVacuum; /* True if incr-vacuum is enabled */ |
#endif |
- u16 pageSize; /* Total number of bytes on a page */ |
- u16 usableSize; /* Number of usable bytes on each page */ |
+ u8 inTransaction; /* Transaction state */ |
+ u8 doNotUseWAL; /* If true, do not open write-ahead-log file */ |
u16 maxLocal; /* Maximum local payload in non-LEAFDATA tables */ |
u16 minLocal; /* Minimum local payload in non-LEAFDATA tables */ |
u16 maxLeaf; /* Maximum local payload in a LEAFDATA table */ |
u16 minLeaf; /* Minimum local payload in a LEAFDATA table */ |
- u8 inTransaction; /* Transaction state */ |
+ u32 pageSize; /* Total number of bytes on a page */ |
+ u32 usableSize; /* Number of usable bytes on each page */ |
int nTransaction; /* Number of open transactions (read + write) */ |
+ u32 nPage; /* Number of pages in the database */ |
void *pSchema; /* Pointer to space allocated by sqlite3BtreeSchema() */ |
void (*xFreeSchema)(void*); /* Destructor for BtShared.pSchema */ |
- sqlite3_mutex *mutex; /* Non-recursive mutex required to access this struct */ |
+ sqlite3_mutex *mutex; /* Non-recursive mutex required to access this object */ |
Bitvec *pHasContent; /* Set of pages moved to free-list this transaction */ |
#ifndef SQLITE_OMIT_SHARED_CACHE |
int nRef; /* Number of references to this structure */ |
@@ -443,8 +446,8 @@ struct BtShared { |
*/ |
typedef struct CellInfo CellInfo; |
struct CellInfo { |
- u8 *pCell; /* Pointer to the start of cell content */ |
i64 nKey; /* The key for INTKEY tables, or number of bytes in key */ |
+ u8 *pCell; /* Pointer to the start of cell content */ |
u32 nData; /* Number of bytes of data */ |
u32 nPayload; /* Total amount of payload */ |
u16 nHeader; /* Size of the cell content header in bytes */ |
@@ -471,7 +474,7 @@ struct CellInfo { |
** The entry is identified by its MemPage and the index in |
** MemPage.aCell[] of the entry. |
** |
-** When a single database file can shared by two more database connections, |
+** A single database file can shared by two more database connections, |
** but cursors cannot be shared. Each cursor is associated with a |
** particular database connection identified BtCursor.pBtree.db. |
** |
@@ -486,20 +489,20 @@ struct BtCursor { |
Pgno pgnoRoot; /* The root page of this tree */ |
sqlite3_int64 cachedRowid; /* Next rowid cache. 0 means not valid */ |
CellInfo info; /* A parse of the cell we are pointing at */ |
+ i64 nKey; /* Size of pKey, or last integer key */ |
+ void *pKey; /* Saved key that was cursor's last known position */ |
+ int skipNext; /* Prev() is noop if negative. Next() is noop if positive */ |
u8 wrFlag; /* True if writable */ |
u8 atLast; /* Cursor pointing to the last entry */ |
u8 validNKey; /* True if info.nKey is valid */ |
u8 eState; /* One of the CURSOR_XXX constants (see below) */ |
- void *pKey; /* Saved key that was cursor's last known position */ |
- i64 nKey; /* Size of pKey, or last integer key */ |
- int skipNext; /* Prev() is noop if negative. Next() is noop if positive */ |
#ifndef SQLITE_OMIT_INCRBLOB |
- u8 isIncrblobHandle; /* True if this cursor is an incr. io handle */ |
Pgno *aOverflow; /* Cache of overflow page locations */ |
+ u8 isIncrblobHandle; /* True if this cursor is an incr. io handle */ |
#endif |
i16 iPage; /* Index of current page in apPage */ |
- MemPage *apPage[BTCURSOR_MAX_DEPTH]; /* Pages from root to current page */ |
u16 aiIdx[BTCURSOR_MAX_DEPTH]; /* Current index in apPage[i] */ |
+ MemPage *apPage[BTCURSOR_MAX_DEPTH]; /* Pages from root to current page */ |
}; |
/* |