wasCSharpSQLite – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | using Pgno = System.UInt32; |
2 | |||
3 | namespace Community.CsharpSqlite |
||
4 | { |
||
5 | public partial class Sqlite3 |
||
6 | { |
||
7 | /* |
||
8 | ** 2001 September 15 |
||
9 | ** |
||
10 | ** The author disclaims copyright to this source code. In place of |
||
11 | ** a legal notice, here is a blessing: |
||
12 | ** |
||
13 | ** May you do good and not evil. |
||
14 | ** May you find forgiveness for yourself and forgive others. |
||
15 | ** May you share freely, never taking more than you give. |
||
16 | ** |
||
17 | ************************************************************************* |
||
18 | ** This header file defines the interface that the sqlite page cache |
||
19 | ** subsystem. The page cache subsystem reads and writes a file a page |
||
20 | ** at a time and provides a journal for rollback. |
||
21 | ************************************************************************* |
||
22 | ** Included in SQLite3 port to C#-SQLite; 2008 Noah B Hart |
||
23 | ** C#-SQLite is an independent reimplementation of the SQLite software library |
||
24 | ** |
||
25 | ** SQLITE_SOURCE_ID: 2011-05-19 13:26:54 ed1da510a239ea767a01dc332b667119fa3c908e |
||
26 | ** |
||
27 | ************************************************************************* |
||
28 | */ |
||
29 | //#if !_PAGER_H_ |
||
30 | //#define _PAGER_H_ |
||
31 | |||
32 | /* |
||
33 | ** Default maximum size for persistent journal files. A negative |
||
34 | ** value means no limit. This value may be overridden using the |
||
35 | ** sqlite3PagerJournalSizeLimit() API. See also "PRAGMA journal_size_limit". |
||
36 | */ |
||
37 | #if !SQLITE_DEFAULT_JOURNAL_SIZE_LIMIT |
||
38 | const int SQLITE_DEFAULT_JOURNAL_SIZE_LIMIT = -1;//#define SQLITE_DEFAULT_JOURNAL_SIZE_LIMIT -1 |
||
39 | #endif |
||
40 | |||
41 | /* |
||
42 | ** The type used to represent a page number. The first page in a file |
||
43 | ** is called page 1. 0 is used to represent "not a page". |
||
44 | */ |
||
45 | //typedef u32 Pgno; |
||
46 | |||
47 | /* |
||
48 | ** Each open file is managed by a separate instance of the "Pager" structure. |
||
49 | */ |
||
50 | //typedef struct Pager Pager; |
||
51 | |||
52 | /* |
||
53 | ** Handle type for pages. |
||
54 | */ |
||
55 | //typedef struct PgHdr DbPage; |
||
56 | |||
57 | /* |
||
58 | ** Page number PAGER_MJ_PGNO is never used in an SQLite database (it is |
||
59 | ** reserved for working around a windows/posix incompatibility). It is |
||
60 | ** used in the journal to signify that the remainder of the journal file |
||
61 | ** is devoted to storing a master journal name - there are no more pages to |
||
62 | ** roll back. See comments for function writeMasterJournal() in pager.c |
||
63 | ** for details. |
||
64 | */ |
||
65 | //#define PAGER_MJ_PGNO(x) ((Pgno)((PENDING_BYTE/((x)->pageSize))+1)) |
||
66 | static Pgno PAGER_MJ_PGNO( Pager x ) |
||
67 | { |
||
68 | return ( (Pgno)( ( PENDING_BYTE / ( ( x ).pageSize ) ) + 1 ) ); |
||
69 | } |
||
70 | /* |
||
71 | ** Allowed values for the flags parameter to sqlite3PagerOpen(). |
||
72 | ** |
||
73 | ** NOTE: These values must match the corresponding BTREE_ values in btree.h. |
||
74 | */ |
||
75 | //#define PAGER_OMIT_JOURNAL 0x0001 /* Do not use a rollback journal */ |
||
76 | //#define PAGER_NO_READLOCK 0x0002 /* Omit readlocks on readonly files */ |
||
77 | //#define PAGER_MEMORY 0x0004 /* In-memory database */ |
||
78 | const int PAGER_OMIT_JOURNAL = 0x0001; |
||
79 | const int PAGER_NO_READLOCK = 0x0002; |
||
80 | const int PAGER_MEMORY = 0x0004; |
||
81 | |||
82 | /* |
||
83 | ** Valid values for the second argument to sqlite3PagerLockingMode(). |
||
84 | */ |
||
85 | //#define PAGER_LOCKINGMODE_QUERY -1 |
||
86 | //#define PAGER_LOCKINGMODE_NORMAL 0 |
||
87 | //#define PAGER_LOCKINGMODE_EXCLUSIVE 1 |
||
88 | static int PAGER_LOCKINGMODE_QUERY = -1; |
||
89 | static int PAGER_LOCKINGMODE_NORMAL = 0; |
||
90 | static int PAGER_LOCKINGMODE_EXCLUSIVE = 1; |
||
91 | |||
92 | /* |
||
93 | ** Numeric constants that encode the journalmode. |
||
94 | */ |
||
95 | //#define PAGER_JOURNALMODE_QUERY (-1) /* Query the value of journalmode */ |
||
96 | //#define PAGER_JOURNALMODE_DELETE 0 /* Commit by deleting journal file */ |
||
97 | //#define PAGER_JOURNALMODE_PERSIST 1 /* Commit by zeroing journal header */ |
||
98 | //#define PAGER_JOURNALMODE_OFF 2 /* Journal omitted. */ |
||
99 | //#define PAGER_JOURNALMODE_TRUNCATE 3 /* Commit by truncating journal */ |
||
100 | //#define PAGER_JOURNALMODE_MEMORY 4 /* In-memory journal file */ |
||
101 | //#define PAGER_JOURNALMODE_WAL 5 /* Use write-ahead logging */ |
||
102 | const int PAGER_JOURNALMODE_QUERY = -1; |
||
103 | const int PAGER_JOURNALMODE_DELETE = 0; |
||
104 | const int PAGER_JOURNALMODE_PERSIST = 1; |
||
105 | const int PAGER_JOURNALMODE_OFF = 2; |
||
106 | const int PAGER_JOURNALMODE_TRUNCATE = 3; |
||
107 | const int PAGER_JOURNALMODE_MEMORY = 4; |
||
108 | const int PAGER_JOURNALMODE_WAL = 5; |
||
109 | |||
110 | /* |
||
111 | ** The remainder of this file contains the declarations of the functions |
||
112 | ** that make up the Pager sub-system API. See source code comments for |
||
113 | ** a detailed description of each routine. |
||
114 | */ |
||
115 | /* Open and close a Pager connection. */ |
||
116 | //int sqlite3PagerOpen( |
||
117 | // sqlite3_vfs*, |
||
118 | // Pager **ppPager, |
||
119 | // const char*, |
||
120 | // int, |
||
121 | // int, |
||
122 | // int, |
||
123 | //// void()(DbPage) |
||
124 | //); |
||
125 | //int sqlite3PagerClose(Pager *pPager); |
||
126 | //int sqlite3PagerReadFileheader(Pager*, int, unsigned char); |
||
127 | |||
128 | /* Functions used to configure a Pager object. */ |
||
129 | //void sqlite3PagerSetBusyhandler(Pager*, int()(void ), object ); |
||
130 | //int sqlite3PagerSetPagesize(Pager*, u32*, int); |
||
131 | //int sqlite3PagerMaxPageCount(Pager*, int); |
||
132 | //void sqlite3PagerSetCachesize(Pager*, int); |
||
133 | //void sqlite3PagerSetSafetyLevel(Pager*,int,int,int); |
||
134 | //int sqlite3PagerLockingMode(Pager *, int); |
||
135 | //int sqlite3PagerSetJournalMode(Pager *, int); |
||
136 | //int sqlite3PagerGetJournalMode(Pager); |
||
137 | //int sqlite3PagerOkToChangeJournalMode(Pager); |
||
138 | //i64 sqlite3PagerJournalSizeLimit(Pager *, i64); |
||
139 | //sqlite3_backup **sqlite3PagerBackupPtr(Pager); |
||
140 | |||
141 | /* Functions used to obtain and release page references. */ |
||
142 | //int sqlite3PagerAcquire(Pager *pPager, Pgno pgno, DbPage **ppPage, int clrFlag); |
||
143 | //#define sqlite3PagerGet(A,B,C) sqlite3PagerAcquire(A,B,C,0) |
||
144 | //DbPage *sqlite3PagerLookup(Pager *pPager, Pgno pgno); |
||
145 | //void sqlite3PagerRef(DbPage); |
||
146 | //void sqlite3PagerUnref(DbPage); |
||
147 | |||
148 | /* Operations on page references. */ |
||
149 | //int sqlite3PagerWrite(DbPage); |
||
150 | //void sqlite3PagerDontWrite(DbPage); |
||
151 | //int sqlite3PagerMovepage(Pager*,DbPage*,Pgno,int); |
||
152 | //int sqlite3PagerPageRefcount(DbPage); |
||
153 | //void *sqlite3PagerGetData(DbPage ); |
||
154 | //void *sqlite3PagerGetExtra(DbPage ); |
||
155 | |||
156 | /* Functions used to manage pager transactions and savepoints. */ |
||
157 | //void sqlite3PagerPagecount(Pager*, int); |
||
158 | //int sqlite3PagerBegin(Pager*, int exFlag, int); |
||
159 | //int sqlite3PagerCommitPhaseOne(Pager*,string zMaster, int); |
||
160 | //int sqlite3PagerExclusiveLock(Pager); |
||
161 | //int sqlite3PagerSync(Pager *pPager); |
||
162 | //int sqlite3PagerCommitPhaseTwo(Pager); |
||
163 | //int sqlite3PagerRollback(Pager); |
||
164 | //int sqlite3PagerOpenSavepoint(Pager *pPager, int n); |
||
165 | //int sqlite3PagerSavepoint(Pager *pPager, int op, int iSavepoint); |
||
166 | //int sqlite3PagerSharedLock(Pager *pPager); |
||
167 | |||
168 | //int sqlite3PagerCheckpoint(Pager *pPager, int, int*, int); |
||
169 | //int sqlite3PagerWalSupported(Pager* pPager); |
||
170 | //int sqlite3PagerWalCallback(Pager* pPager); |
||
171 | //int sqlite3PagerOpenWal(Pager* pPager, int* pisOpen); |
||
172 | //int sqlite3PagerCloseWal(Pager* pPager); |
||
173 | |||
174 | /* Functions used to query pager state and configuration. */ |
||
175 | //u8 sqlite3PagerIsreadonly(Pager); |
||
176 | //int sqlite3PagerRefcount(Pager); |
||
177 | //int sqlite3PagerMemUsed(Pager); |
||
178 | //string sqlite3PagerFilename(Pager); |
||
179 | //const sqlite3_vfs *sqlite3PagerVfs(Pager); |
||
180 | //sqlite3_file *sqlite3PagerFile(Pager); |
||
181 | //string sqlite3PagerJournalname(Pager); |
||
182 | //int sqlite3PagerNosync(Pager); |
||
183 | //void *sqlite3PagerTempSpace(Pager); |
||
184 | //int sqlite3PagerIsMemdb(Pager); |
||
185 | |||
186 | /* Functions used to truncate the database file. */ |
||
187 | //void sqlite3PagerTruncateImage(Pager*,Pgno); |
||
188 | |||
189 | //#if (SQLITE_HAS_CODEC) && !defined(SQLITE_OMIT_WAL) |
||
190 | //void *sqlite3PagerCodec(DbPage ); |
||
191 | //#endif |
||
192 | |||
193 | /* Functions to support testing and debugging. */ |
||
194 | //#if !NDEBUG || SQLITE_TEST |
||
195 | // Pgno sqlite3PagerPagenumber(DbPage); |
||
196 | // int sqlite3PagerIswriteable(DbPage); |
||
197 | //#endif |
||
198 | //#if SQLITE_TEST |
||
199 | // int *sqlite3PagerStats(Pager); |
||
200 | // void sqlite3PagerRefdump(Pager); |
||
201 | // void disable_simulated_io_errors(void); |
||
202 | // void enable_simulated_io_errors(void); |
||
203 | //#else |
||
204 | //# define disable_simulated_io_errors() |
||
205 | //# define enable_simulated_io_errors() |
||
206 | //#endif |
||
207 | } |
||
208 | } |