wasCSharpSQLite – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | namespace Community.CsharpSqlite |
2 | { |
||
3 | public partial class Sqlite3 |
||
4 | { |
||
5 | /* |
||
6 | ** 2001 September 15 |
||
7 | ** |
||
8 | ** The author disclaims copyright to this source code. In place of |
||
9 | ** a legal notice, here is a blessing: |
||
10 | ** |
||
11 | ** May you do good and not evil. |
||
12 | ** May you find forgiveness for yourself and forgive others. |
||
13 | ** May you share freely, never taking more than you give. |
||
14 | ** |
||
15 | ************************************************************************* |
||
16 | ** This header file defines the interface that the sqlite B-Tree file |
||
17 | ** subsystem. See comments in the source code for a detailed description |
||
18 | ** of what each interface routine does. |
||
19 | ************************************************************************* |
||
20 | ** Included in SQLite3 port to C#-SQLite; 2008 Noah B Hart |
||
21 | ** C#-SQLite is an independent reimplementation of the SQLite software library |
||
22 | ** |
||
23 | ** SQLITE_SOURCE_ID: 2011-06-23 19:49:22 4374b7e83ea0a3fbc3691f9c0c936272862f32f2 |
||
24 | ** |
||
25 | ************************************************************************* |
||
26 | */ |
||
27 | //#if !_BTREE_H_ |
||
28 | //#define _BTREE_H_ |
||
29 | |||
30 | /* TODO: This definition is just included so other modules compile. It |
||
31 | ** needs to be revisited. |
||
32 | */ |
||
33 | const int SQLITE_N_BTREE_META = 10; |
||
34 | |||
35 | /* |
||
36 | ** If defined as non-zero, auto-vacuum is enabled by default. Otherwise |
||
37 | ** it must be turned on for each database using "PRAGMA auto_vacuum = 1". |
||
38 | */ |
||
39 | #if !SQLITE_DEFAULT_AUTOVACUUM |
||
40 | const int SQLITE_DEFAULT_AUTOVACUUM = 0; |
||
41 | #endif |
||
42 | |||
43 | const int BTREE_AUTOVACUUM_NONE = 0; /* Do not do auto-vacuum */ |
||
44 | const int BTREE_AUTOVACUUM_FULL = 1; /* Do full auto-vacuum */ |
||
45 | const int BTREE_AUTOVACUUM_INCR = 2; /* Incremental vacuum */ |
||
46 | |||
47 | /* |
||
48 | ** Forward declarations of structure |
||
49 | */ |
||
50 | //typedef struct Btree Btree; |
||
51 | //typedef struct BtCursor BtCursor; |
||
52 | //typedef struct BtShared BtShared; |
||
53 | |||
54 | //int sqlite3BtreeOpen( |
||
55 | // sqlite3_vfs *pVfs, /* VFS to use with this b-tree */ |
||
56 | // string zFilename, /* Name of database file to open */ |
||
57 | // sqlite3 db, /* Associated database connection */ |
||
58 | // Btree **ppBtree, /* Return open Btree* here */ |
||
59 | // int flags, /* Flags */ |
||
60 | // int vfsFlags /* Flags passed through to VFS open */ |
||
61 | //); |
||
62 | |||
63 | /* The flags parameter to sqlite3BtreeOpen can be the bitwise or of the |
||
64 | ** following values. |
||
65 | ** |
||
66 | ** NOTE: These values must match the corresponding PAGER_ values in |
||
67 | ** pager.h. |
||
68 | */ |
||
69 | //#define BTREE_OMIT_JOURNAL 1 /* Do not create or use a rollback journal */ |
||
70 | //#define BTREE_NO_READLOCK 2 /* Omit readlocks on readonly files */ |
||
71 | //#define BTREE_MEMORY 4 /* This is an in-memory DB */ |
||
72 | //#define BTREE_SINGLE 8 /* The file contains at most 1 b-tree */ |
||
73 | //#define BTREE_UNORDERED 16 /* Use of a hash implementation is OK */ |
||
74 | const int BTREE_OMIT_JOURNAL = 1; /* Do not create or use a rollback journal */ |
||
75 | const int BTREE_NO_READLOCK = 2; /* Omit readlocks on readonly files */ |
||
76 | const int BTREE_MEMORY = 4; /* This is an in-memory DB */ |
||
77 | const int BTREE_SINGLE = 8; /* The file contains at most 1 b-tree */ |
||
78 | const int BTREE_UNORDERED = 16; /* Use of a hash implementation is OK */ |
||
79 | |||
80 | //int sqlite3BtreeClose(Btree); |
||
81 | //int sqlite3BtreeSetCacheSize(Btree*,int); |
||
82 | //int sqlite3BtreeSetSafetyLevel(Btree*,int,int,int); |
||
83 | //int sqlite3BtreeSyncDisabled(Btree); |
||
84 | //int sqlite3BtreeSetPageSize(Btree *p, int nPagesize, int nReserve, int eFix); |
||
85 | //int sqlite3BtreeGetPageSize(Btree); |
||
86 | //int sqlite3BtreeMaxPageCount(Btree*,int); |
||
87 | //u32 sqlite3BtreeLastPage(Btree); |
||
88 | //int sqlite3BtreeSecureDelete(Btree*,int); |
||
89 | //int sqlite3BtreeGetReserve(Btree); |
||
90 | //int sqlite3BtreeSetAutoVacuum(Btree , int); |
||
91 | //int sqlite3BtreeGetAutoVacuum(Btree ); |
||
92 | //int sqlite3BtreeBeginTrans(Btree*,int); |
||
93 | //int sqlite3BtreeCommitPhaseOne(Btree*, string zMaster); |
||
94 | //int sqlite3BtreeCommitPhaseTwo(Btree*, int); |
||
95 | //int sqlite3BtreeCommit(Btree); |
||
96 | //int sqlite3BtreeRollback(Btree); |
||
97 | //int sqlite3BtreeBeginStmt(Btree); |
||
98 | //int sqlite3BtreeCreateTable(Btree*, int*, int flags); |
||
99 | //int sqlite3BtreeIsInTrans(Btree); |
||
100 | //int sqlite3BtreeIsInReadTrans(Btree); |
||
101 | //int sqlite3BtreeIsInBackup(Btree); |
||
102 | //void *sqlite3BtreeSchema(Btree , int, void()(void )); |
||
103 | //int sqlite3BtreeSchemaLocked( Btree* pBtree ); |
||
104 | //int sqlite3BtreeLockTable( Btree* pBtree, int iTab, u8 isWriteLock ); |
||
105 | //int sqlite3BtreeSavepoint(Btree *, int, int); |
||
106 | |||
107 | //string sqlite3BtreeGetFilename(Btree ); |
||
108 | //string sqlite3BtreeGetJournalname(Btree ); |
||
109 | //int sqlite3BtreeCopyFile(Btree *, Btree ); |
||
110 | |||
111 | //int sqlite3BtreeIncrVacuum(Btree ); |
||
112 | |||
113 | /* The flags parameter to sqlite3BtreeCreateTable can be the bitwise OR |
||
114 | ** of the flags shown below. |
||
115 | ** |
||
116 | ** Every SQLite table must have either BTREE_INTKEY or BTREE_BLOBKEY set. |
||
117 | ** With BTREE_INTKEY, the table key is a 64-bit integer and arbitrary data |
||
118 | ** is stored in the leaves. (BTREE_INTKEY is used for SQL tables.) With |
||
119 | ** BTREE_BLOBKEY, the key is an arbitrary BLOB and no content is stored |
||
120 | ** anywhere - the key is the content. (BTREE_BLOBKEY is used for SQL |
||
121 | ** indices.) |
||
122 | */ |
||
123 | //#define BTREE_INTKEY 1 /* Table has only 64-bit signed integer keys */ |
||
124 | //#define BTREE_BLOBKEY 2 /* Table has keys only - no data */ |
||
125 | const int BTREE_INTKEY = 1; |
||
126 | const int BTREE_BLOBKEY = 2; |
||
127 | |||
128 | //int sqlite3BtreeDropTable(Btree*, int, int); |
||
129 | //int sqlite3BtreeClearTable(Btree*, int, int); |
||
130 | //void sqlite3BtreeTripAllCursors(Btree*, int); |
||
131 | |||
132 | //void sqlite3BtreeGetMeta(Btree *pBtree, int idx, u32 *pValue); |
||
133 | //int sqlite3BtreeUpdateMeta(Btree*, int idx, u32 value); |
||
134 | |||
135 | |||
136 | /* |
||
137 | ** The second parameter to sqlite3BtreeGetMeta or sqlite3BtreeUpdateMeta |
||
138 | ** should be one of the following values. The integer values are assigned |
||
139 | ** to constants so that the offset of the corresponding field in an |
||
140 | ** SQLite database header may be found using the following formula: |
||
141 | ** |
||
142 | ** offset = 36 + (idx * 4) |
||
143 | ** |
||
144 | ** For example, the free-page-count field is located at byte offset 36 of |
||
145 | ** the database file header. The incr-vacuum-flag field is located at |
||
146 | ** byte offset 64 (== 36+4*7). |
||
147 | */ |
||
148 | //#define BTREE_FREE_PAGE_COUNT 0 |
||
149 | //#define BTREE_SCHEMA_VERSION 1 |
||
150 | //#define BTREE_FILE_FORMAT 2 |
||
151 | //#define BTREE_DEFAULT_CACHE_SIZE 3 |
||
152 | //#define BTREE_LARGEST_ROOT_PAGE 4 |
||
153 | //#define BTREE_TEXT_ENCODING 5 |
||
154 | //#define BTREE_USER_VERSION 6 |
||
155 | //#define BTREE_INCR_VACUUM 7 |
||
156 | const int BTREE_FREE_PAGE_COUNT = 0; |
||
157 | const int BTREE_SCHEMA_VERSION = 1; |
||
158 | const int BTREE_FILE_FORMAT = 2; |
||
159 | const int BTREE_DEFAULT_CACHE_SIZE = 3; |
||
160 | const int BTREE_LARGEST_ROOT_PAGE = 4; |
||
161 | const int BTREE_TEXT_ENCODING = 5; |
||
162 | const int BTREE_USER_VERSION = 6; |
||
163 | const int BTREE_INCR_VACUUM = 7; |
||
164 | |||
165 | //int sqlite3BtreeCursor( |
||
166 | // Btree*, /* BTree containing table to open */ |
||
167 | // int iTable, /* Index of root page */ |
||
168 | // int wrFlag, /* 1 for writing. 0 for read-only */ |
||
169 | // struct KeyInfo*, /* First argument to compare function */ |
||
170 | // BtCursor pCursor /* Space to write cursor structure */ |
||
171 | //); |
||
172 | //int sqlite3BtreeCursorSize(void); |
||
173 | //void sqlite3BtreeCursorZero(BtCursor); |
||
174 | |||
175 | //int sqlite3BtreeCloseCursor(BtCursor); |
||
176 | //int sqlite3BtreeMovetoUnpacked( |
||
177 | // BtCursor*, |
||
178 | // UnpackedRecord pUnKey, |
||
179 | // i64 intKey, |
||
180 | // int bias, |
||
181 | // int pRes |
||
182 | //); |
||
183 | //int sqlite3BtreeCursorHasMoved(BtCursor*, int); |
||
184 | //int sqlite3BtreeDelete(BtCursor); |
||
185 | //int sqlite3BtreeInsert(BtCursor*, const void pKey, i64 nKey, |
||
186 | // const void pData, int nData, |
||
187 | // int nZero, int bias, int seekResult); |
||
188 | //int sqlite3BtreeFirst(BtCursor*, int pRes); |
||
189 | //int sqlite3BtreeLast(BtCursor*, int pRes); |
||
190 | //int sqlite3BtreeNext(BtCursor*, int pRes); |
||
191 | //int sqlite3BtreeEof(BtCursor); |
||
192 | //int sqlite3BtreePrevious(BtCursor*, int pRes); |
||
193 | //int sqlite3BtreeKeySize(BtCursor*, i64 pSize); |
||
194 | //int sqlite3BtreeKey(BtCursor*, u32 offset, u32 amt, void); |
||
195 | //const void *sqlite3BtreeKeyFetch(BtCursor*, int pAmt); |
||
196 | //const void *sqlite3BtreeDataFetch(BtCursor*, int pAmt); |
||
197 | //int sqlite3BtreeDataSize(BtCursor*, u32 pSize); |
||
198 | //int sqlite3BtreeData(BtCursor*, u32 offset, u32 amt, void); |
||
199 | //void sqlite3BtreeSetCachedRowid(BtCursor*, sqlite3_int64); |
||
200 | //sqlite3_int64 sqlite3BtreeGetCachedRowid(BtCursor); |
||
201 | |||
202 | //char *sqlite3BtreeIntegrityCheck(Btree*, int *aRoot, int nRoot, int, int); |
||
203 | //struct Pager *sqlite3BtreePager(Btree); |
||
204 | |||
205 | //int sqlite3BtreePutData(BtCursor*, u32 offset, u32 amt, void); |
||
206 | //void sqlite3BtreeCacheOverflow(BtCursor ); |
||
207 | //void sqlite3BtreeClearCursor(BtCursor ); |
||
208 | |||
209 | //int sqlite3BtreeSetVersion(Btree *pBt, int iVersion); |
||
210 | |||
211 | //#if !NDEBUG |
||
212 | //int sqlite3BtreeCursorIsValid(BtCursor); |
||
213 | //#endif |
||
214 | |||
215 | //#if !SQLITE_OMIT_BTREECOUNT |
||
216 | //int sqlite3BtreeCount(BtCursor *, i64 ); |
||
217 | //#endif |
||
218 | |||
219 | //#if SQLITE_TEST |
||
220 | //int sqlite3BtreeCursorInfo(BtCursor*, int*, int); |
||
221 | //void sqlite3BtreeCursorList(Btree); |
||
222 | //#endif |
||
223 | |||
224 | #if !SQLITE_OMIT_WAL |
||
225 | //int sqlite3BtreeCheckpoint(Btree*, int, int *, int ); |
||
226 | #endif |
||
227 | |||
228 | /* |
||
229 | ** If we are not using shared cache, then there is no need to |
||
230 | ** use mutexes to access the BtShared structures. So make the |
||
231 | ** Enter and Leave procedures no-ops. |
||
232 | */ |
||
233 | #if !SQLITE_OMIT_SHARED_CACHE |
||
234 | //void sqlite3BtreeEnter(Btree); |
||
235 | //void sqlite3BtreeEnterAll(sqlite3); |
||
236 | #else |
||
237 | //# define sqlite3BtreeEnter(X) |
||
238 | static void sqlite3BtreeEnter( Btree bt ) |
||
239 | { |
||
240 | } |
||
241 | //# define sqlite3BtreeEnterAll(X) |
||
242 | static void sqlite3BtreeEnterAll( sqlite3 p ) |
||
243 | { |
||
244 | } |
||
245 | #endif |
||
246 | |||
247 | #if !(SQLITE_OMIT_SHARED_CACHE) && SQLITE_THREADSAFE |
||
248 | //int sqlite3BtreeSharable(Btree); |
||
249 | //void sqlite3BtreeLeave(Btree); |
||
250 | //void sqlite3BtreeEnterCursor(BtCursor); |
||
251 | //void sqlite3BtreeLeaveCursor(BtCursor); |
||
252 | //void sqlite3BtreeLeaveAll(sqlite3); |
||
253 | #if !NDEBUG |
||
254 | /* These routines are used inside Debug.Assert() statements only. */ |
||
255 | int sqlite3BtreeHoldsMutex(Btree); |
||
256 | int sqlite3BtreeHoldsAllMutexes(sqlite3); |
||
257 | int sqlite3SchemaMutexHeld(sqlite3*,int,Schema); |
||
258 | #endif |
||
259 | #else |
||
260 | //# define sqlite3BtreeSharable(X) 0 |
||
261 | static bool sqlite3BtreeSharable( Btree X ) |
||
262 | { |
||
263 | return false; |
||
264 | } |
||
265 | |||
266 | //# define sqlite3BtreeLeave(X) |
||
267 | static void sqlite3BtreeLeave( Btree X ) |
||
268 | { |
||
269 | } |
||
270 | |||
271 | //# define sqlite3BtreeEnterCursor(X) |
||
272 | static void sqlite3BtreeEnterCursor( BtCursor X ) |
||
273 | { |
||
274 | } |
||
275 | |||
276 | //# define sqlite3BtreeLeaveCursor(X) |
||
277 | static void sqlite3BtreeLeaveCursor( BtCursor X ) |
||
278 | { |
||
279 | } |
||
280 | |||
281 | //# define sqlite3BtreeLeaveAll(X) |
||
282 | static void sqlite3BtreeLeaveAll( sqlite3 X ) |
||
283 | { |
||
284 | } |
||
285 | |||
286 | //# define sqlite3BtreeHoldsMutex(X) 1 |
||
287 | static bool sqlite3BtreeHoldsMutex( Btree X ) |
||
288 | { |
||
289 | return true; |
||
290 | } |
||
291 | |||
292 | //# define sqlite3BtreeHoldsAllMutexes(X) 1 |
||
293 | static bool sqlite3BtreeHoldsAllMutexes( sqlite3 X ) |
||
294 | { |
||
295 | return true; |
||
296 | } |
||
297 | //# define sqlite3SchemaMutexHeld(X,Y,Z) 1 |
||
298 | static bool sqlite3SchemaMutexHeld( sqlite3 X, int y, Schema z ) |
||
299 | { |
||
300 | return true; |
||
301 | } |
||
302 | #endif |
||
303 | |||
304 | //#endif // * _BTREE_H_ */ |
||
305 | } |
||
306 | } |