monotone

monotone Mtn Source Tree

Root/sqlite/btree.h

1/*
2** 2001 September 15
3**
4** The author disclaims copyright to this source code. In place of
5** a legal notice, here is a blessing:
6**
7** May you do good and not evil.
8** May you find forgiveness for yourself and forgive others.
9** May you share freely, never taking more than you give.
10**
11*************************************************************************
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
14** of what each interface routine does.
15**
16** @(#) $Id: btree.h,v 1.82 2007/05/08 21:45:27 drh Exp $
17*/
18#ifndef _BTREE_H_
19#define _BTREE_H_
20
21/* TODO: This definition is just included so other modules compile. It
22** needs to be revisited.
23*/
24#define SQLITE_N_BTREE_META 10
25
26/*
27** If defined as non-zero, auto-vacuum is enabled by default. Otherwise
28** it must be turned on for each database using "PRAGMA auto_vacuum = 1".
29*/
30#ifndef SQLITE_DEFAULT_AUTOVACUUM
31 #define SQLITE_DEFAULT_AUTOVACUUM 0
32#endif
33
34#define BTREE_AUTOVACUUM_NONE 0 /* Do not do auto-vacuum */
35#define BTREE_AUTOVACUUM_FULL 1 /* Do full auto-vacuum */
36#define BTREE_AUTOVACUUM_INCR 2 /* Incremental vacuum */
37
38/*
39** Forward declarations of structure
40*/
41typedef struct Btree Btree;
42typedef struct BtCursor BtCursor;
43typedef struct BtShared BtShared;
44
45
46int sqlite3BtreeOpen(
47 const char *zFilename, /* Name of database file to open */
48 sqlite3 *db, /* Associated database connection */
49 Btree **, /* Return open Btree* here */
50 int flags /* Flags */
51);
52
53/* The flags parameter to sqlite3BtreeOpen can be the bitwise or of the
54** following values.
55**
56** NOTE: These values must match the corresponding PAGER_ values in
57** pager.h.
58*/
59#define BTREE_OMIT_JOURNAL 1 /* Do not use journal. No argument */
60#define BTREE_NO_READLOCK 2 /* Omit readlocks on readonly files */
61#define BTREE_MEMORY 4 /* In-memory DB. No argument */
62
63int sqlite3BtreeClose(Btree*);
64int sqlite3BtreeSetBusyHandler(Btree*,BusyHandler*);
65int sqlite3BtreeSetCacheSize(Btree*,int);
66int sqlite3BtreeSetSafetyLevel(Btree*,int,int);
67int sqlite3BtreeSyncDisabled(Btree*);
68int sqlite3BtreeSetPageSize(Btree*,int,int);
69int sqlite3BtreeGetPageSize(Btree*);
70int sqlite3BtreeMaxPageCount(Btree*,int);
71int sqlite3BtreeGetReserve(Btree*);
72int sqlite3BtreeSetAutoVacuum(Btree *, int);
73int sqlite3BtreeGetAutoVacuum(Btree *);
74int sqlite3BtreeBeginTrans(Btree*,int);
75int sqlite3BtreeCommitPhaseOne(Btree*, const char *zMaster);
76int sqlite3BtreeCommitPhaseTwo(Btree*);
77int sqlite3BtreeCommit(Btree*);
78int sqlite3BtreeRollback(Btree*);
79int sqlite3BtreeBeginStmt(Btree*);
80int sqlite3BtreeCommitStmt(Btree*);
81int sqlite3BtreeRollbackStmt(Btree*);
82int sqlite3BtreeCreateTable(Btree*, int*, int flags);
83int sqlite3BtreeIsInTrans(Btree*);
84int sqlite3BtreeIsInStmt(Btree*);
85int sqlite3BtreeIsInReadTrans(Btree*);
86void *sqlite3BtreeSchema(Btree *, int, void(*)(void *));
87int sqlite3BtreeSchemaLocked(Btree *);
88int sqlite3BtreeLockTable(Btree *, int, u8);
89
90const char *sqlite3BtreeGetFilename(Btree *);
91const char *sqlite3BtreeGetDirname(Btree *);
92const char *sqlite3BtreeGetJournalname(Btree *);
93int sqlite3BtreeCopyFile(Btree *, Btree *);
94
95int sqlite3BtreeIncrVacuum(Btree *);
96
97/* The flags parameter to sqlite3BtreeCreateTable can be the bitwise OR
98** of the following flags:
99*/
100#define BTREE_INTKEY 1 /* Table has only 64-bit signed integer keys */
101#define BTREE_ZERODATA 2 /* Table has keys only - no data */
102#define BTREE_LEAFDATA 4 /* Data stored in leaves only. Implies INTKEY */
103
104int sqlite3BtreeDropTable(Btree*, int, int*);
105int sqlite3BtreeClearTable(Btree*, int);
106int sqlite3BtreeGetMeta(Btree*, int idx, u32 *pValue);
107int sqlite3BtreeUpdateMeta(Btree*, int idx, u32 value);
108
109int sqlite3BtreeCursor(
110 Btree*, /* BTree containing table to open */
111 int iTable, /* Index of root page */
112 int wrFlag, /* 1 for writing. 0 for read-only */
113 int(*)(void*,int,const void*,int,const void*), /* Key comparison function */
114 void*, /* First argument to compare function */
115 BtCursor **ppCursor /* Returned cursor */
116);
117
118int sqlite3BtreeCloseCursor(BtCursor*);
119int sqlite3BtreeMoveto(BtCursor*,const void *pKey,i64 nKey,int bias,int *pRes);
120int sqlite3BtreeDelete(BtCursor*);
121int sqlite3BtreeInsert(BtCursor*, const void *pKey, i64 nKey,
122 const void *pData, int nData,
123 int nZero, int bias);
124int sqlite3BtreeFirst(BtCursor*, int *pRes);
125int sqlite3BtreeLast(BtCursor*, int *pRes);
126int sqlite3BtreeNext(BtCursor*, int *pRes);
127int sqlite3BtreeEof(BtCursor*);
128int sqlite3BtreeFlags(BtCursor*);
129int sqlite3BtreePrevious(BtCursor*, int *pRes);
130int sqlite3BtreeKeySize(BtCursor*, i64 *pSize);
131int sqlite3BtreeKey(BtCursor*, u32 offset, u32 amt, void*);
132const void *sqlite3BtreeKeyFetch(BtCursor*, int *pAmt);
133const void *sqlite3BtreeDataFetch(BtCursor*, int *pAmt);
134int sqlite3BtreeDataSize(BtCursor*, u32 *pSize);
135int sqlite3BtreeData(BtCursor*, u32 offset, u32 amt, void*);
136
137char *sqlite3BtreeIntegrityCheck(Btree*, int *aRoot, int nRoot, int, int*);
138struct Pager *sqlite3BtreePager(Btree*);
139
140int sqlite3BtreePutData(BtCursor*, u32 offset, u32 amt, void*);
141void sqlite3BtreeCacheOverflow(BtCursor *);
142
143#ifdef SQLITE_TEST
144int sqlite3BtreeCursorInfo(BtCursor*, int*, int);
145void sqlite3BtreeCursorList(Btree*);
146int sqlite3BtreePageDump(Btree*, int, int recursive);
147#endif
148
149#endif /* _BTREE_H_ */

Archive Download this file

Branches

Tags

Quick Links:     www.monotone.ca    -     Downloads    -     Documentation    -     Wiki    -     Code Forge    -     Build Status