OLD | NEW |
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 ** |
11 ************************************************************************* | 11 ************************************************************************* |
12 ** This header file defines the interface that the sqlite B-Tree file | 12 ** This header file defines the interface that the sqlite B-Tree file |
13 ** subsystem. See comments in the source code for a detailed description | 13 ** subsystem. See comments in the source code for a detailed description |
14 ** of what each interface routine does. | 14 ** of what each interface routine does. |
15 */ | 15 */ |
16 #ifndef _BTREE_H_ | 16 #ifndef SQLITE_BTREE_H |
17 #define _BTREE_H_ | 17 #define SQLITE_BTREE_H |
18 | 18 |
19 /* TODO: This definition is just included so other modules compile. It | 19 /* TODO: This definition is just included so other modules compile. It |
20 ** needs to be revisited. | 20 ** needs to be revisited. |
21 */ | 21 */ |
22 #define SQLITE_N_BTREE_META 16 | 22 #define SQLITE_N_BTREE_META 16 |
23 | 23 |
24 /* | 24 /* |
25 ** If defined as non-zero, auto-vacuum is enabled by default. Otherwise | 25 ** If defined as non-zero, auto-vacuum is enabled by default. Otherwise |
26 ** it must be turned on for each database using "PRAGMA auto_vacuum = 1". | 26 ** it must be turned on for each database using "PRAGMA auto_vacuum = 1". |
27 */ | 27 */ |
28 #ifndef SQLITE_DEFAULT_AUTOVACUUM | 28 #ifndef SQLITE_DEFAULT_AUTOVACUUM |
29 #define SQLITE_DEFAULT_AUTOVACUUM 0 | 29 #define SQLITE_DEFAULT_AUTOVACUUM 0 |
30 #endif | 30 #endif |
31 | 31 |
32 #define BTREE_AUTOVACUUM_NONE 0 /* Do not do auto-vacuum */ | 32 #define BTREE_AUTOVACUUM_NONE 0 /* Do not do auto-vacuum */ |
33 #define BTREE_AUTOVACUUM_FULL 1 /* Do full auto-vacuum */ | 33 #define BTREE_AUTOVACUUM_FULL 1 /* Do full auto-vacuum */ |
34 #define BTREE_AUTOVACUUM_INCR 2 /* Incremental vacuum */ | 34 #define BTREE_AUTOVACUUM_INCR 2 /* Incremental vacuum */ |
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 typedef struct BtreePayload BtreePayload; |
42 | 43 |
43 | 44 |
44 int sqlite3BtreeOpen( | 45 int sqlite3BtreeOpen( |
45 sqlite3_vfs *pVfs, /* VFS to use with this b-tree */ | 46 sqlite3_vfs *pVfs, /* VFS to use with this b-tree */ |
46 const char *zFilename, /* Name of database file to open */ | 47 const char *zFilename, /* Name of database file to open */ |
47 sqlite3 *db, /* Associated database connection */ | 48 sqlite3 *db, /* Associated database connection */ |
48 Btree **ppBtree, /* Return open Btree* here */ | 49 Btree **ppBtree, /* Return open Btree* here */ |
49 int flags, /* Flags */ | 50 int flags, /* Flags */ |
50 int vfsFlags /* Flags passed through to VFS open */ | 51 int vfsFlags /* Flags passed through to VFS open */ |
51 ); | 52 ); |
52 | 53 |
53 /* The flags parameter to sqlite3BtreeOpen can be the bitwise or of the | 54 /* The flags parameter to sqlite3BtreeOpen can be the bitwise or of the |
54 ** following values. | 55 ** following values. |
55 ** | 56 ** |
56 ** NOTE: These values must match the corresponding PAGER_ values in | 57 ** NOTE: These values must match the corresponding PAGER_ values in |
57 ** pager.h. | 58 ** pager.h. |
58 */ | 59 */ |
59 #define BTREE_OMIT_JOURNAL 1 /* Do not create or use a rollback journal */ | 60 #define BTREE_OMIT_JOURNAL 1 /* Do not create or use a rollback journal */ |
60 #define BTREE_MEMORY 2 /* This is an in-memory DB */ | 61 #define BTREE_MEMORY 2 /* This is an in-memory DB */ |
61 #define BTREE_SINGLE 4 /* The file contains at most 1 b-tree */ | 62 #define BTREE_SINGLE 4 /* The file contains at most 1 b-tree */ |
62 #define BTREE_UNORDERED 8 /* Use of a hash implementation is OK */ | 63 #define BTREE_UNORDERED 8 /* Use of a hash implementation is OK */ |
63 | 64 |
64 int sqlite3BtreeClose(Btree*); | 65 int sqlite3BtreeClose(Btree*); |
65 int sqlite3BtreeSetCacheSize(Btree*,int); | 66 int sqlite3BtreeSetCacheSize(Btree*,int); |
66 int sqlite3BtreeSetSpillSize(Btree*,int); | 67 int sqlite3BtreeSetSpillSize(Btree*,int); |
67 #if SQLITE_MAX_MMAP_SIZE>0 | 68 #if SQLITE_MAX_MMAP_SIZE>0 |
68 int sqlite3BtreeSetMmapLimit(Btree*,sqlite3_int64); | 69 int sqlite3BtreeSetMmapLimit(Btree*,sqlite3_int64); |
69 #endif | 70 #endif |
70 int sqlite3BtreeSetPagerFlags(Btree*,unsigned); | 71 int sqlite3BtreeSetPagerFlags(Btree*,unsigned); |
71 int sqlite3BtreeSyncDisabled(Btree*); | |
72 int sqlite3BtreeSetPageSize(Btree *p, int nPagesize, int nReserve, int eFix); | 72 int sqlite3BtreeSetPageSize(Btree *p, int nPagesize, int nReserve, int eFix); |
73 int sqlite3BtreeGetPageSize(Btree*); | 73 int sqlite3BtreeGetPageSize(Btree*); |
74 int sqlite3BtreeMaxPageCount(Btree*,int); | 74 int sqlite3BtreeMaxPageCount(Btree*,int); |
75 u32 sqlite3BtreeLastPage(Btree*); | 75 u32 sqlite3BtreeLastPage(Btree*); |
76 int sqlite3BtreeSecureDelete(Btree*,int); | 76 int sqlite3BtreeSecureDelete(Btree*,int); |
77 int sqlite3BtreeGetOptimalReserve(Btree*); | 77 int sqlite3BtreeGetOptimalReserve(Btree*); |
78 int sqlite3BtreeGetReserveNoMutex(Btree *p); | 78 int sqlite3BtreeGetReserveNoMutex(Btree *p); |
79 int sqlite3BtreeSetAutoVacuum(Btree *, int); | 79 int sqlite3BtreeSetAutoVacuum(Btree *, int); |
80 int sqlite3BtreeGetAutoVacuum(Btree *); | 80 int sqlite3BtreeGetAutoVacuum(Btree *); |
81 int sqlite3BtreeBeginTrans(Btree*,int); | 81 int sqlite3BtreeBeginTrans(Btree*,int); |
82 int sqlite3BtreeCommitPhaseOne(Btree*, const char *zMaster); | 82 int sqlite3BtreeCommitPhaseOne(Btree*, const char *zMaster); |
83 int sqlite3BtreeCommitPhaseTwo(Btree*, int); | 83 int sqlite3BtreeCommitPhaseTwo(Btree*, int); |
84 int sqlite3BtreeCommit(Btree*); | 84 int sqlite3BtreeCommit(Btree*); |
85 int sqlite3BtreeRollback(Btree*,int,int); | 85 int sqlite3BtreeRollback(Btree*,int,int); |
86 int sqlite3BtreeBeginStmt(Btree*,int); | 86 int sqlite3BtreeBeginStmt(Btree*,int); |
87 int sqlite3BtreeCreateTable(Btree*, int*, int flags); | 87 int sqlite3BtreeCreateTable(Btree*, int*, int flags); |
88 int sqlite3BtreeIsInTrans(Btree*); | 88 int sqlite3BtreeIsInTrans(Btree*); |
89 int sqlite3BtreeIsInReadTrans(Btree*); | 89 int sqlite3BtreeIsInReadTrans(Btree*); |
90 int sqlite3BtreeIsInBackup(Btree*); | 90 int sqlite3BtreeIsInBackup(Btree*); |
91 void *sqlite3BtreeSchema(Btree *, int, void(*)(void *)); | 91 void *sqlite3BtreeSchema(Btree *, int, void(*)(void *)); |
92 int sqlite3BtreeSchemaLocked(Btree *pBtree); | 92 int sqlite3BtreeSchemaLocked(Btree *pBtree); |
| 93 #ifndef SQLITE_OMIT_SHARED_CACHE |
93 int sqlite3BtreeLockTable(Btree *pBtree, int iTab, u8 isWriteLock); | 94 int sqlite3BtreeLockTable(Btree *pBtree, int iTab, u8 isWriteLock); |
| 95 #endif |
94 int sqlite3BtreeSavepoint(Btree *, int, int); | 96 int sqlite3BtreeSavepoint(Btree *, int, int); |
95 | 97 |
96 const char *sqlite3BtreeGetFilename(Btree *); | 98 const char *sqlite3BtreeGetFilename(Btree *); |
97 const char *sqlite3BtreeGetJournalname(Btree *); | 99 const char *sqlite3BtreeGetJournalname(Btree *); |
98 int sqlite3BtreeCopyFile(Btree *, Btree *); | 100 int sqlite3BtreeCopyFile(Btree *, Btree *); |
99 | 101 |
100 int sqlite3BtreeIncrVacuum(Btree *); | 102 int sqlite3BtreeIncrVacuum(Btree *); |
101 | 103 |
102 /* The flags parameter to sqlite3BtreeCreateTable can be the bitwise OR | 104 /* The flags parameter to sqlite3BtreeCreateTable can be the bitwise OR |
103 ** of the flags shown below. | 105 ** of the flags shown below. |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 ** be used only for equality key searches. | 194 ** be used only for equality key searches. |
193 ** | 195 ** |
194 */ | 196 */ |
195 #define BTREE_BULKLOAD 0x00000001 /* Used to full index in sorted order */ | 197 #define BTREE_BULKLOAD 0x00000001 /* Used to full index in sorted order */ |
196 #define BTREE_SEEK_EQ 0x00000002 /* EQ seeks only - no range seeks */ | 198 #define BTREE_SEEK_EQ 0x00000002 /* EQ seeks only - no range seeks */ |
197 | 199 |
198 /* | 200 /* |
199 ** Flags passed as the third argument to sqlite3BtreeCursor(). | 201 ** Flags passed as the third argument to sqlite3BtreeCursor(). |
200 ** | 202 ** |
201 ** For read-only cursors the wrFlag argument is always zero. For read-write | 203 ** For read-only cursors the wrFlag argument is always zero. For read-write |
202 ** cursors it may be set to either (BTREE_WRCSR|BTREE_FORDELETE) or | 204 ** cursors it may be set to either (BTREE_WRCSR|BTREE_FORDELETE) or just |
203 ** (BTREE_WRCSR). If the BTREE_FORDELETE flag is set, then the cursor will | 205 ** (BTREE_WRCSR). If the BTREE_FORDELETE bit is set, then the cursor will |
204 ** only be used by SQLite for the following: | 206 ** only be used by SQLite for the following: |
205 ** | 207 ** |
206 ** * to seek to and delete specific entries, and/or | 208 ** * to seek to and then delete specific entries, and/or |
207 ** | 209 ** |
208 ** * to read values that will be used to create keys that other | 210 ** * to read values that will be used to create keys that other |
209 ** BTREE_FORDELETE cursors will seek to and delete. | 211 ** BTREE_FORDELETE cursors will seek to and delete. |
| 212 ** |
| 213 ** The BTREE_FORDELETE flag is an optimization hint. It is not used by |
| 214 ** by this, the native b-tree engine of SQLite, but it is available to |
| 215 ** alternative storage engines that might be substituted in place of this |
| 216 ** b-tree system. For alternative storage engines in which a delete of |
| 217 ** the main table row automatically deletes corresponding index rows, |
| 218 ** the FORDELETE flag hint allows those alternative storage engines to |
| 219 ** skip a lot of work. Namely: FORDELETE cursors may treat all SEEK |
| 220 ** and DELETE operations as no-ops, and any READ operation against a |
| 221 ** FORDELETE cursor may return a null row: 0x01 0x00. |
210 */ | 222 */ |
211 #define BTREE_WRCSR 0x00000004 /* read-write cursor */ | 223 #define BTREE_WRCSR 0x00000004 /* read-write cursor */ |
212 #define BTREE_FORDELETE 0x00000008 /* Cursor is for seek/delete only */ | 224 #define BTREE_FORDELETE 0x00000008 /* Cursor is for seek/delete only */ |
213 | 225 |
214 int sqlite3BtreeCursor( | 226 int sqlite3BtreeCursor( |
215 Btree*, /* BTree containing table to open */ | 227 Btree*, /* BTree containing table to open */ |
216 int iTable, /* Index of root page */ | 228 int iTable, /* Index of root page */ |
217 int wrFlag, /* 1 for writing. 0 for read-only */ | 229 int wrFlag, /* 1 for writing. 0 for read-only */ |
218 struct KeyInfo*, /* First argument to compare function */ | 230 struct KeyInfo*, /* First argument to compare function */ |
219 BtCursor *pCursor /* Space to write cursor structure */ | 231 BtCursor *pCursor /* Space to write cursor structure */ |
220 ); | 232 ); |
221 int sqlite3BtreeCursorSize(void); | 233 int sqlite3BtreeCursorSize(void); |
222 void sqlite3BtreeCursorZero(BtCursor*); | 234 void sqlite3BtreeCursorZero(BtCursor*); |
223 void sqlite3BtreeCursorHintFlags(BtCursor*, unsigned); | 235 void sqlite3BtreeCursorHintFlags(BtCursor*, unsigned); |
224 #ifdef SQLITE_ENABLE_CURSOR_HINTS | 236 #ifdef SQLITE_ENABLE_CURSOR_HINTS |
225 void sqlite3BtreeCursorHint(BtCursor*, int, ...); | 237 void sqlite3BtreeCursorHint(BtCursor*, int, ...); |
226 #endif | 238 #endif |
227 | 239 |
228 int sqlite3BtreeCloseCursor(BtCursor*); | 240 int sqlite3BtreeCloseCursor(BtCursor*); |
229 int sqlite3BtreeMovetoUnpacked( | 241 int sqlite3BtreeMovetoUnpacked( |
230 BtCursor*, | 242 BtCursor*, |
231 UnpackedRecord *pUnKey, | 243 UnpackedRecord *pUnKey, |
232 i64 intKey, | 244 i64 intKey, |
233 int bias, | 245 int bias, |
234 int *pRes | 246 int *pRes |
235 ); | 247 ); |
236 int sqlite3BtreeCursorHasMoved(BtCursor*); | 248 int sqlite3BtreeCursorHasMoved(BtCursor*); |
237 int sqlite3BtreeCursorRestore(BtCursor*, int*); | 249 int sqlite3BtreeCursorRestore(BtCursor*, int*); |
238 int sqlite3BtreeDelete(BtCursor*, int); | 250 int sqlite3BtreeDelete(BtCursor*, u8 flags); |
239 int sqlite3BtreeInsert(BtCursor*, const void *pKey, i64 nKey, | 251 |
240 const void *pData, int nData, | 252 /* Allowed flags for sqlite3BtreeDelete() and sqlite3BtreeInsert() */ |
241 int nZero, int bias, int seekResult); | 253 #define BTREE_SAVEPOSITION 0x02 /* Leave cursor pointing at NEXT or PREV */ |
| 254 #define BTREE_AUXDELETE 0x04 /* not the primary delete operation */ |
| 255 #define BTREE_APPEND 0x08 /* Insert is likely an append */ |
| 256 |
| 257 /* An instance of the BtreePayload object describes the content of a single |
| 258 ** entry in either an index or table btree. |
| 259 ** |
| 260 ** Index btrees (used for indexes and also WITHOUT ROWID tables) contain |
| 261 ** an arbitrary key and no data. These btrees have pKey,nKey set to their |
| 262 ** key and pData,nData,nZero set to zero. |
| 263 ** |
| 264 ** Table btrees (used for rowid tables) contain an integer rowid used as |
| 265 ** the key and passed in the nKey field. The pKey field is zero. |
| 266 ** pData,nData hold the content of the new entry. nZero extra zero bytes |
| 267 ** are appended to the end of the content when constructing the entry. |
| 268 ** |
| 269 ** This object is used to pass information into sqlite3BtreeInsert(). The |
| 270 ** same information used to be passed as five separate parameters. But placing |
| 271 ** the information into this object helps to keep the interface more |
| 272 ** organized and understandable, and it also helps the resulting code to |
| 273 ** run a little faster by using fewer registers for parameter passing. |
| 274 */ |
| 275 struct BtreePayload { |
| 276 const void *pKey; /* Key content for indexes. NULL for tables */ |
| 277 sqlite3_int64 nKey; /* Size of pKey for indexes. PRIMARY KEY for tabs */ |
| 278 const void *pData; /* Data for tables. NULL for indexes */ |
| 279 struct Mem *aMem; /* First of nMem value in the unpacked pKey */ |
| 280 u16 nMem; /* Number of aMem[] value. Might be zero */ |
| 281 int nData; /* Size of pData. 0 if none. */ |
| 282 int nZero; /* Extra zero data appended after pData,nData */ |
| 283 }; |
| 284 |
| 285 int sqlite3BtreeInsert(BtCursor*, const BtreePayload *pPayload, |
| 286 int flags, int seekResult); |
242 int sqlite3BtreeFirst(BtCursor*, int *pRes); | 287 int sqlite3BtreeFirst(BtCursor*, int *pRes); |
243 int sqlite3BtreeLast(BtCursor*, int *pRes); | 288 int sqlite3BtreeLast(BtCursor*, int *pRes); |
244 int sqlite3BtreeNext(BtCursor*, int *pRes); | 289 int sqlite3BtreeNext(BtCursor*, int *pRes); |
245 int sqlite3BtreeEof(BtCursor*); | 290 int sqlite3BtreeEof(BtCursor*); |
246 int sqlite3BtreePrevious(BtCursor*, int *pRes); | 291 int sqlite3BtreePrevious(BtCursor*, int *pRes); |
247 int sqlite3BtreeKeySize(BtCursor*, i64 *pSize); | 292 i64 sqlite3BtreeIntegerKey(BtCursor*); |
248 int sqlite3BtreeKey(BtCursor*, u32 offset, u32 amt, void*); | 293 int sqlite3BtreePayload(BtCursor*, u32 offset, u32 amt, void*); |
249 const void *sqlite3BtreeKeyFetch(BtCursor*, u32 *pAmt); | 294 const void *sqlite3BtreePayloadFetch(BtCursor*, u32 *pAmt); |
250 const void *sqlite3BtreeDataFetch(BtCursor*, u32 *pAmt); | 295 u32 sqlite3BtreePayloadSize(BtCursor*); |
251 int sqlite3BtreeDataSize(BtCursor*, u32 *pSize); | |
252 int sqlite3BtreeData(BtCursor*, u32 offset, u32 amt, void*); | |
253 | 296 |
254 char *sqlite3BtreeIntegrityCheck(Btree*, int *aRoot, int nRoot, int, int*); | 297 char *sqlite3BtreeIntegrityCheck(Btree*, int *aRoot, int nRoot, int, int*); |
255 struct Pager *sqlite3BtreePager(Btree*); | 298 struct Pager *sqlite3BtreePager(Btree*); |
256 | 299 |
| 300 #ifndef SQLITE_OMIT_INCRBLOB |
| 301 int sqlite3BtreePayloadChecked(BtCursor*, u32 offset, u32 amt, void*); |
257 int sqlite3BtreePutData(BtCursor*, u32 offset, u32 amt, void*); | 302 int sqlite3BtreePutData(BtCursor*, u32 offset, u32 amt, void*); |
258 void sqlite3BtreeIncrblobCursor(BtCursor *); | 303 void sqlite3BtreeIncrblobCursor(BtCursor *); |
| 304 #endif |
259 void sqlite3BtreeClearCursor(BtCursor *); | 305 void sqlite3BtreeClearCursor(BtCursor *); |
260 int sqlite3BtreeSetVersion(Btree *pBt, int iVersion); | 306 int sqlite3BtreeSetVersion(Btree *pBt, int iVersion); |
261 int sqlite3BtreeCursorHasHint(BtCursor*, unsigned int mask); | 307 int sqlite3BtreeCursorHasHint(BtCursor*, unsigned int mask); |
262 int sqlite3BtreeIsReadonly(Btree *pBt); | 308 int sqlite3BtreeIsReadonly(Btree *pBt); |
263 int sqlite3HeaderSizeBtree(void); | 309 int sqlite3HeaderSizeBtree(void); |
264 | 310 |
265 #ifndef NDEBUG | 311 #ifndef NDEBUG |
266 int sqlite3BtreeCursorIsValid(BtCursor*); | 312 int sqlite3BtreeCursorIsValid(BtCursor*); |
267 #endif | 313 #endif |
| 314 int sqlite3BtreeCursorIsValidNN(BtCursor*); |
268 | 315 |
269 #ifndef SQLITE_OMIT_BTREECOUNT | 316 #ifndef SQLITE_OMIT_BTREECOUNT |
270 int sqlite3BtreeCount(BtCursor *, i64 *); | 317 int sqlite3BtreeCount(BtCursor *, i64 *); |
271 #endif | 318 #endif |
272 | 319 |
273 #ifdef SQLITE_TEST | 320 #ifdef SQLITE_TEST |
274 int sqlite3BtreeCursorInfo(BtCursor*, int*, int); | 321 int sqlite3BtreeCursorInfo(BtCursor*, int*, int); |
275 void sqlite3BtreeCursorList(Btree*); | 322 void sqlite3BtreeCursorList(Btree*); |
276 #endif | 323 #endif |
277 | 324 |
278 #ifndef SQLITE_OMIT_WAL | 325 #ifndef SQLITE_OMIT_WAL |
279 int sqlite3BtreeCheckpoint(Btree*, int, int *, int *); | 326 int sqlite3BtreeCheckpoint(Btree*, int, int *, int *); |
280 #endif | 327 #endif |
281 | 328 |
282 /* | 329 /* |
283 ** If we are not using shared cache, then there is no need to | 330 ** If we are not using shared cache, then there is no need to |
284 ** use mutexes to access the BtShared structures. So make the | 331 ** use mutexes to access the BtShared structures. So make the |
285 ** Enter and Leave procedures no-ops. | 332 ** Enter and Leave procedures no-ops. |
286 */ | 333 */ |
287 #ifndef SQLITE_OMIT_SHARED_CACHE | 334 #ifndef SQLITE_OMIT_SHARED_CACHE |
288 void sqlite3BtreeEnter(Btree*); | 335 void sqlite3BtreeEnter(Btree*); |
289 void sqlite3BtreeEnterAll(sqlite3*); | 336 void sqlite3BtreeEnterAll(sqlite3*); |
| 337 int sqlite3BtreeSharable(Btree*); |
| 338 void sqlite3BtreeEnterCursor(BtCursor*); |
| 339 int sqlite3BtreeConnectionCount(Btree*); |
290 #else | 340 #else |
291 # define sqlite3BtreeEnter(X) | 341 # define sqlite3BtreeEnter(X) |
292 # define sqlite3BtreeEnterAll(X) | 342 # define sqlite3BtreeEnterAll(X) |
| 343 # define sqlite3BtreeSharable(X) 0 |
| 344 # define sqlite3BtreeEnterCursor(X) |
| 345 # define sqlite3BtreeConnectionCount(X) 1 |
293 #endif | 346 #endif |
294 | 347 |
295 #if !defined(SQLITE_OMIT_SHARED_CACHE) && SQLITE_THREADSAFE | 348 #if !defined(SQLITE_OMIT_SHARED_CACHE) && SQLITE_THREADSAFE |
296 int sqlite3BtreeSharable(Btree*); | |
297 void sqlite3BtreeLeave(Btree*); | 349 void sqlite3BtreeLeave(Btree*); |
298 void sqlite3BtreeEnterCursor(BtCursor*); | |
299 void sqlite3BtreeLeaveCursor(BtCursor*); | 350 void sqlite3BtreeLeaveCursor(BtCursor*); |
300 void sqlite3BtreeLeaveAll(sqlite3*); | 351 void sqlite3BtreeLeaveAll(sqlite3*); |
301 #ifndef NDEBUG | 352 #ifndef NDEBUG |
302 /* These routines are used inside assert() statements only. */ | 353 /* These routines are used inside assert() statements only. */ |
303 int sqlite3BtreeHoldsMutex(Btree*); | 354 int sqlite3BtreeHoldsMutex(Btree*); |
304 int sqlite3BtreeHoldsAllMutexes(sqlite3*); | 355 int sqlite3BtreeHoldsAllMutexes(sqlite3*); |
305 int sqlite3SchemaMutexHeld(sqlite3*,int,Schema*); | 356 int sqlite3SchemaMutexHeld(sqlite3*,int,Schema*); |
306 #endif | 357 #endif |
307 #else | 358 #else |
308 | 359 |
309 # define sqlite3BtreeSharable(X) 0 | |
310 # define sqlite3BtreeLeave(X) | 360 # define sqlite3BtreeLeave(X) |
311 # define sqlite3BtreeEnterCursor(X) | |
312 # define sqlite3BtreeLeaveCursor(X) | 361 # define sqlite3BtreeLeaveCursor(X) |
313 # define sqlite3BtreeLeaveAll(X) | 362 # define sqlite3BtreeLeaveAll(X) |
314 | 363 |
315 # define sqlite3BtreeHoldsMutex(X) 1 | 364 # define sqlite3BtreeHoldsMutex(X) 1 |
316 # define sqlite3BtreeHoldsAllMutexes(X) 1 | 365 # define sqlite3BtreeHoldsAllMutexes(X) 1 |
317 # define sqlite3SchemaMutexHeld(X,Y,Z) 1 | 366 # define sqlite3SchemaMutexHeld(X,Y,Z) 1 |
318 #endif | 367 #endif |
319 | 368 |
320 | 369 |
321 #endif /* _BTREE_H_ */ | 370 #endif /* SQLITE_BTREE_H */ |
OLD | NEW |