Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Side by Side Diff: third_party/sqlite/sqlite-src-3080704/src/btree.h

Issue 883353008: [sql] Import reference version of SQLite 3.8.7.4. (Closed) Base URL: http://chromium.googlesource.com/chromium/src.git@master
Patch Set: Hold back encoding change which is messing up patch. Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 ** 2001 September 15 2 ** 2001 September 15
3 ** 3 **
4 ** The author disclaims copyright to this source code. In place of 4 ** The author disclaims copyright to this source code. In place of
5 ** a legal notice, here is a blessing: 5 ** a legal notice, here is a blessing:
6 ** 6 **
7 ** May you do good and not evil. 7 ** May you do good and not evil.
8 ** May you find forgiveness for yourself and forgive others. 8 ** May you find forgiveness for yourself and forgive others.
9 ** May you share freely, never taking more than you give. 9 ** May you share freely, never taking more than you give.
10 ** 10 **
(...skipping 24 matching lines...) Expand all
35 35
36 /* 36 /*
37 ** Forward declarations of structure 37 ** Forward declarations of structure
38 */ 38 */
39 typedef struct Btree Btree; 39 typedef struct Btree Btree;
40 typedef struct BtCursor BtCursor; 40 typedef struct BtCursor BtCursor;
41 typedef struct BtShared BtShared; 41 typedef struct BtShared BtShared;
42 42
43 43
44 int sqlite3BtreeOpen( 44 int sqlite3BtreeOpen(
45 sqlite3_vfs *pVfs, /* VFS to use with this b-tree */
45 const char *zFilename, /* Name of database file to open */ 46 const char *zFilename, /* Name of database file to open */
46 sqlite3 *db, /* Associated database connection */ 47 sqlite3 *db, /* Associated database connection */
47 Btree **ppBtree, /* Return open Btree* here */ 48 Btree **ppBtree, /* Return open Btree* here */
48 int flags, /* Flags */ 49 int flags, /* Flags */
49 int vfsFlags /* Flags passed through to VFS open */ 50 int vfsFlags /* Flags passed through to VFS open */
50 ); 51 );
51 52
52 /* The flags parameter to sqlite3BtreeOpen can be the bitwise or of the 53 /* The flags parameter to sqlite3BtreeOpen can be the bitwise or of the
53 ** following values. 54 ** following values.
54 ** 55 **
55 ** NOTE: These values must match the corresponding PAGER_ values in 56 ** NOTE: These values must match the corresponding PAGER_ values in
56 ** pager.h. 57 ** pager.h.
57 */ 58 */
58 #define BTREE_OMIT_JOURNAL 1 /* Do not create or use a rollback journal */ 59 #define BTREE_OMIT_JOURNAL 1 /* Do not create or use a rollback journal */
59 #define BTREE_NO_READLOCK 2 /* Omit readlocks on readonly files */ 60 #define BTREE_MEMORY 2 /* This is an in-memory DB */
60 #define BTREE_MEMORY 4 /* This is an in-memory DB */ 61 #define BTREE_SINGLE 4 /* The file contains at most 1 b-tree */
61 #define BTREE_SINGLE 8 /* The file contains at most 1 b-tree */ 62 #define BTREE_UNORDERED 8 /* Use of a hash implementation is OK */
62 #define BTREE_UNORDERED 16 /* Use of a hash implementation is OK */
63 63
64 int sqlite3BtreeClose(Btree*); 64 int sqlite3BtreeClose(Btree*);
65 int sqlite3BtreeSetCacheSize(Btree*,int); 65 int sqlite3BtreeSetCacheSize(Btree*,int);
66 int sqlite3BtreeSetSafetyLevel(Btree*,int,int,int); 66 #if SQLITE_MAX_MMAP_SIZE>0
67 int sqlite3BtreeSetMmapLimit(Btree*,sqlite3_int64);
68 #endif
69 int sqlite3BtreeSetPagerFlags(Btree*,unsigned);
67 int sqlite3BtreeSyncDisabled(Btree*); 70 int sqlite3BtreeSyncDisabled(Btree*);
68 int sqlite3BtreeSetPageSize(Btree *p, int nPagesize, int nReserve, int eFix); 71 int sqlite3BtreeSetPageSize(Btree *p, int nPagesize, int nReserve, int eFix);
69 int sqlite3BtreeGetPageSize(Btree*); 72 int sqlite3BtreeGetPageSize(Btree*);
70 int sqlite3BtreeMaxPageCount(Btree*,int); 73 int sqlite3BtreeMaxPageCount(Btree*,int);
71 u32 sqlite3BtreeLastPage(Btree*); 74 u32 sqlite3BtreeLastPage(Btree*);
72 int sqlite3BtreeSecureDelete(Btree*,int); 75 int sqlite3BtreeSecureDelete(Btree*,int);
73 int sqlite3BtreeGetReserve(Btree*); 76 int sqlite3BtreeGetReserve(Btree*);
77 #if defined(SQLITE_HAS_CODEC) || defined(SQLITE_DEBUG)
78 int sqlite3BtreeGetReserveNoMutex(Btree *p);
79 #endif
74 int sqlite3BtreeSetAutoVacuum(Btree *, int); 80 int sqlite3BtreeSetAutoVacuum(Btree *, int);
75 int sqlite3BtreeGetAutoVacuum(Btree *); 81 int sqlite3BtreeGetAutoVacuum(Btree *);
76 int sqlite3BtreeBeginTrans(Btree*,int); 82 int sqlite3BtreeBeginTrans(Btree*,int);
77 int sqlite3BtreeCommitPhaseOne(Btree*, const char *zMaster); 83 int sqlite3BtreeCommitPhaseOne(Btree*, const char *zMaster);
78 int sqlite3BtreeCommitPhaseTwo(Btree*, int); 84 int sqlite3BtreeCommitPhaseTwo(Btree*, int);
79 int sqlite3BtreeCommit(Btree*); 85 int sqlite3BtreeCommit(Btree*);
80 int sqlite3BtreeRollback(Btree*); 86 int sqlite3BtreeRollback(Btree*,int,int);
81 int sqlite3BtreeBeginStmt(Btree*,int); 87 int sqlite3BtreeBeginStmt(Btree*,int);
82 int sqlite3BtreeCreateTable(Btree*, int*, int flags); 88 int sqlite3BtreeCreateTable(Btree*, int*, int flags);
83 int sqlite3BtreeIsInTrans(Btree*); 89 int sqlite3BtreeIsInTrans(Btree*);
84 int sqlite3BtreeIsInReadTrans(Btree*); 90 int sqlite3BtreeIsInReadTrans(Btree*);
85 int sqlite3BtreeIsInBackup(Btree*); 91 int sqlite3BtreeIsInBackup(Btree*);
86 void *sqlite3BtreeSchema(Btree *, int, void(*)(void *)); 92 void *sqlite3BtreeSchema(Btree *, int, void(*)(void *));
87 int sqlite3BtreeSchemaLocked(Btree *pBtree); 93 int sqlite3BtreeSchemaLocked(Btree *pBtree);
88 int sqlite3BtreeLockTable(Btree *pBtree, int iTab, u8 isWriteLock); 94 int sqlite3BtreeLockTable(Btree *pBtree, int iTab, u8 isWriteLock);
89 int sqlite3BtreeSavepoint(Btree *, int, int); 95 int sqlite3BtreeSavepoint(Btree *, int, int);
90 96
(...skipping 11 matching lines...) Expand all
102 ** is stored in the leaves. (BTREE_INTKEY is used for SQL tables.) With 108 ** is stored in the leaves. (BTREE_INTKEY is used for SQL tables.) With
103 ** BTREE_BLOBKEY, the key is an arbitrary BLOB and no content is stored 109 ** BTREE_BLOBKEY, the key is an arbitrary BLOB and no content is stored
104 ** anywhere - the key is the content. (BTREE_BLOBKEY is used for SQL 110 ** anywhere - the key is the content. (BTREE_BLOBKEY is used for SQL
105 ** indices.) 111 ** indices.)
106 */ 112 */
107 #define BTREE_INTKEY 1 /* Table has only 64-bit signed integer keys */ 113 #define BTREE_INTKEY 1 /* Table has only 64-bit signed integer keys */
108 #define BTREE_BLOBKEY 2 /* Table has keys only - no data */ 114 #define BTREE_BLOBKEY 2 /* Table has keys only - no data */
109 115
110 int sqlite3BtreeDropTable(Btree*, int, int*); 116 int sqlite3BtreeDropTable(Btree*, int, int*);
111 int sqlite3BtreeClearTable(Btree*, int, int*); 117 int sqlite3BtreeClearTable(Btree*, int, int*);
112 void sqlite3BtreeTripAllCursors(Btree*, int); 118 int sqlite3BtreeClearTableOfCursor(BtCursor*);
119 int sqlite3BtreeTripAllCursors(Btree*, int, int);
113 120
114 void sqlite3BtreeGetMeta(Btree *pBtree, int idx, u32 *pValue); 121 void sqlite3BtreeGetMeta(Btree *pBtree, int idx, u32 *pValue);
115 int sqlite3BtreeUpdateMeta(Btree*, int idx, u32 value); 122 int sqlite3BtreeUpdateMeta(Btree*, int idx, u32 value);
116 123
124 int sqlite3BtreeNewDb(Btree *p);
125
117 /* 126 /*
118 ** The second parameter to sqlite3BtreeGetMeta or sqlite3BtreeUpdateMeta 127 ** The second parameter to sqlite3BtreeGetMeta or sqlite3BtreeUpdateMeta
119 ** should be one of the following values. The integer values are assigned 128 ** should be one of the following values. The integer values are assigned
120 ** to constants so that the offset of the corresponding field in an 129 ** to constants so that the offset of the corresponding field in an
121 ** SQLite database header may be found using the following formula: 130 ** SQLite database header may be found using the following formula:
122 ** 131 **
123 ** offset = 36 + (idx * 4) 132 ** offset = 36 + (idx * 4)
124 ** 133 **
125 ** For example, the free-page-count field is located at byte offset 36 of 134 ** For example, the free-page-count field is located at byte offset 36 of
126 ** the database file header. The incr-vacuum-flag field is located at 135 ** the database file header. The incr-vacuum-flag field is located at
127 ** byte offset 64 (== 36+4*7). 136 ** byte offset 64 (== 36+4*7).
128 */ 137 */
129 #define BTREE_FREE_PAGE_COUNT 0 138 #define BTREE_FREE_PAGE_COUNT 0
130 #define BTREE_SCHEMA_VERSION 1 139 #define BTREE_SCHEMA_VERSION 1
131 #define BTREE_FILE_FORMAT 2 140 #define BTREE_FILE_FORMAT 2
132 #define BTREE_DEFAULT_CACHE_SIZE 3 141 #define BTREE_DEFAULT_CACHE_SIZE 3
133 #define BTREE_LARGEST_ROOT_PAGE 4 142 #define BTREE_LARGEST_ROOT_PAGE 4
134 #define BTREE_TEXT_ENCODING 5 143 #define BTREE_TEXT_ENCODING 5
135 #define BTREE_USER_VERSION 6 144 #define BTREE_USER_VERSION 6
136 #define BTREE_INCR_VACUUM 7 145 #define BTREE_INCR_VACUUM 7
146 #define BTREE_APPLICATION_ID 8
147
148 /*
149 ** Values that may be OR'd together to form the second argument of an
150 ** sqlite3BtreeCursorHints() call.
151 */
152 #define BTREE_BULKLOAD 0x00000001
137 153
138 int sqlite3BtreeCursor( 154 int sqlite3BtreeCursor(
139 Btree*, /* BTree containing table to open */ 155 Btree*, /* BTree containing table to open */
140 int iTable, /* Index of root page */ 156 int iTable, /* Index of root page */
141 int wrFlag, /* 1 for writing. 0 for read-only */ 157 int wrFlag, /* 1 for writing. 0 for read-only */
142 struct KeyInfo*, /* First argument to compare function */ 158 struct KeyInfo*, /* First argument to compare function */
143 BtCursor *pCursor /* Space to write cursor structure */ 159 BtCursor *pCursor /* Space to write cursor structure */
144 ); 160 );
145 int sqlite3BtreeCursorSize(void); 161 int sqlite3BtreeCursorSize(void);
146 void sqlite3BtreeCursorZero(BtCursor*); 162 void sqlite3BtreeCursorZero(BtCursor*);
147 163
148 int sqlite3BtreeCloseCursor(BtCursor*); 164 int sqlite3BtreeCloseCursor(BtCursor*);
149 int sqlite3BtreeMovetoUnpacked( 165 int sqlite3BtreeMovetoUnpacked(
150 BtCursor*, 166 BtCursor*,
151 UnpackedRecord *pUnKey, 167 UnpackedRecord *pUnKey,
152 i64 intKey, 168 i64 intKey,
153 int bias, 169 int bias,
154 int *pRes 170 int *pRes
155 ); 171 );
156 int sqlite3BtreeCursorHasMoved(BtCursor*, int*); 172 int sqlite3BtreeCursorHasMoved(BtCursor*);
173 int sqlite3BtreeCursorRestore(BtCursor*, int*);
157 int sqlite3BtreeDelete(BtCursor*); 174 int sqlite3BtreeDelete(BtCursor*);
158 int sqlite3BtreeInsert(BtCursor*, const void *pKey, i64 nKey, 175 int sqlite3BtreeInsert(BtCursor*, const void *pKey, i64 nKey,
159 const void *pData, int nData, 176 const void *pData, int nData,
160 int nZero, int bias, int seekResult); 177 int nZero, int bias, int seekResult);
161 int sqlite3BtreeFirst(BtCursor*, int *pRes); 178 int sqlite3BtreeFirst(BtCursor*, int *pRes);
162 int sqlite3BtreeLast(BtCursor*, int *pRes); 179 int sqlite3BtreeLast(BtCursor*, int *pRes);
163 int sqlite3BtreeNext(BtCursor*, int *pRes); 180 int sqlite3BtreeNext(BtCursor*, int *pRes);
164 int sqlite3BtreeEof(BtCursor*); 181 int sqlite3BtreeEof(BtCursor*);
165 int sqlite3BtreePrevious(BtCursor*, int *pRes); 182 int sqlite3BtreePrevious(BtCursor*, int *pRes);
166 int sqlite3BtreeKeySize(BtCursor*, i64 *pSize); 183 int sqlite3BtreeKeySize(BtCursor*, i64 *pSize);
167 int sqlite3BtreeKey(BtCursor*, u32 offset, u32 amt, void*); 184 int sqlite3BtreeKey(BtCursor*, u32 offset, u32 amt, void*);
168 const void *sqlite3BtreeKeyFetch(BtCursor*, int *pAmt); 185 const void *sqlite3BtreeKeyFetch(BtCursor*, u32 *pAmt);
169 const void *sqlite3BtreeDataFetch(BtCursor*, int *pAmt); 186 const void *sqlite3BtreeDataFetch(BtCursor*, u32 *pAmt);
170 int sqlite3BtreeDataSize(BtCursor*, u32 *pSize); 187 int sqlite3BtreeDataSize(BtCursor*, u32 *pSize);
171 int sqlite3BtreeData(BtCursor*, u32 offset, u32 amt, void*); 188 int sqlite3BtreeData(BtCursor*, u32 offset, u32 amt, void*);
172 void sqlite3BtreeSetCachedRowid(BtCursor*, sqlite3_int64);
173 sqlite3_int64 sqlite3BtreeGetCachedRowid(BtCursor*);
174 189
175 char *sqlite3BtreeIntegrityCheck(Btree*, int *aRoot, int nRoot, int, int*); 190 char *sqlite3BtreeIntegrityCheck(Btree*, int *aRoot, int nRoot, int, int*);
176 struct Pager *sqlite3BtreePager(Btree*); 191 struct Pager *sqlite3BtreePager(Btree*);
177 192
178 int sqlite3BtreePutData(BtCursor*, u32 offset, u32 amt, void*); 193 int sqlite3BtreePutData(BtCursor*, u32 offset, u32 amt, void*);
179 void sqlite3BtreeCacheOverflow(BtCursor *); 194 void sqlite3BtreeIncrblobCursor(BtCursor *);
180 void sqlite3BtreeClearCursor(BtCursor *); 195 void sqlite3BtreeClearCursor(BtCursor *);
181
182 int sqlite3BtreeSetVersion(Btree *pBt, int iVersion); 196 int sqlite3BtreeSetVersion(Btree *pBt, int iVersion);
197 void sqlite3BtreeCursorHints(BtCursor *, unsigned int mask);
198 int sqlite3BtreeIsReadonly(Btree *pBt);
183 199
184 #ifndef NDEBUG 200 #ifndef NDEBUG
185 int sqlite3BtreeCursorIsValid(BtCursor*); 201 int sqlite3BtreeCursorIsValid(BtCursor*);
186 #endif 202 #endif
187 203
188 #ifndef SQLITE_OMIT_BTREECOUNT 204 #ifndef SQLITE_OMIT_BTREECOUNT
189 int sqlite3BtreeCount(BtCursor *, i64 *); 205 int sqlite3BtreeCount(BtCursor *, i64 *);
190 #endif 206 #endif
191 207
192 #ifdef SQLITE_TEST 208 #ifdef SQLITE_TEST
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 # define sqlite3BtreeLeaveCursor(X) 247 # define sqlite3BtreeLeaveCursor(X)
232 # define sqlite3BtreeLeaveAll(X) 248 # define sqlite3BtreeLeaveAll(X)
233 249
234 # define sqlite3BtreeHoldsMutex(X) 1 250 # define sqlite3BtreeHoldsMutex(X) 1
235 # define sqlite3BtreeHoldsAllMutexes(X) 1 251 # define sqlite3BtreeHoldsAllMutexes(X) 1
236 # define sqlite3SchemaMutexHeld(X,Y,Z) 1 252 # define sqlite3SchemaMutexHeld(X,Y,Z) 1
237 #endif 253 #endif
238 254
239 255
240 #endif /* _BTREE_H_ */ 256 #endif /* _BTREE_H_ */
OLDNEW
« no previous file with comments | « third_party/sqlite/sqlite-src-3080704/src/btmutex.c ('k') | third_party/sqlite/sqlite-src-3080704/src/btree.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698