wasCSharpSQLite – Blame information for rev
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | |
2 | using u8 = System.Byte; |
||
3 | using Pgno = System.UInt32; |
||
4 | #if SQLITE_OMIT_WAL |
||
5 | using Wal = System.Object; |
||
6 | #endif |
||
7 | |||
8 | namespace Community.CsharpSqlite |
||
9 | { |
||
10 | public partial class Sqlite3 |
||
11 | { |
||
12 | /* |
||
13 | ** 2010 February 1 |
||
14 | ** |
||
15 | ** The author disclaims copyright to this source code. In place of |
||
16 | ** a legal notice, here is a blessing: |
||
17 | ** |
||
18 | ** May you do good and not evil. |
||
19 | ** May you find forgiveness for yourself and forgive others. |
||
20 | ** May you share freely, never taking more than you give. |
||
21 | ** |
||
22 | ************************************************************************* |
||
23 | ** This header file defines the interface to the write-ahead logging |
||
24 | ** system. Refer to the comments below and the header comment attached to |
||
25 | ** the implementation of each function in log.c for further details. |
||
26 | ************************************************************************* |
||
27 | ** Included in SQLite3 port to C#-SQLite; 2008 Noah B Hart |
||
28 | ** C#-SQLite is an independent reimplementation of the SQLite software library |
||
29 | ** |
||
30 | ** SQLITE_SOURCE_ID: 2011-06-23 19:49:22 4374b7e83ea0a3fbc3691f9c0c936272862f32f2 |
||
31 | ** |
||
32 | ************************************************************************* |
||
33 | */ |
||
34 | |||
35 | //#if !_WAL_H_ |
||
36 | //#define _WAL_H_ |
||
37 | |||
38 | //#include "sqliteInt.h" |
||
39 | |||
40 | #if SQLITE_OMIT_WAL |
||
41 | |||
42 | //# define sqlite3WalOpen(x,y,z) 0 |
||
43 | static int sqlite3WalOpen( sqlite3_vfs x, sqlite3_file y, string z ) |
||
44 | { |
||
45 | return 0; |
||
46 | } |
||
47 | |||
48 | //# define sqlite3WalLimit(x,y) |
||
49 | static void sqlite3WalLimit( sqlite3_vfs x, long y ) |
||
50 | { |
||
51 | } |
||
52 | |||
53 | //# define sqlite3WalClose(w,x,y,z) 0 |
||
54 | static int sqlite3WalClose( Wal w, int x, int y, u8 z ) |
||
55 | { |
||
56 | return 0; |
||
57 | } |
||
58 | |||
59 | //# define sqlite3WalBeginReadTransaction(y,z) 0 |
||
60 | static int sqlite3WalBeginReadTransaction( Wal y, int z ) |
||
61 | { |
||
62 | return 0; |
||
63 | } |
||
64 | |||
65 | //# define sqlite3WalEndReadTransaction(z) |
||
66 | static void sqlite3WalEndReadTransaction( Wal z ) |
||
67 | { |
||
68 | } |
||
69 | |||
70 | //# define sqlite3WalRead(v,w,x,y,z) 0 |
||
71 | static int sqlite3WalRead( Wal v, Pgno w, ref int x, int y, u8[] z ) |
||
72 | { |
||
73 | return 0; |
||
74 | } |
||
75 | |||
76 | //# define sqlite3WalDbsize(y) 0 |
||
77 | static Pgno sqlite3WalDbsize( Wal y ) |
||
78 | { |
||
79 | return 0; |
||
80 | } |
||
81 | |||
82 | //# define sqlite3WalBeginWriteTransaction(y) 0 |
||
83 | static int sqlite3WalBeginWriteTransaction( Wal y ) |
||
84 | { |
||
85 | return 0; |
||
86 | } |
||
87 | |||
88 | //# define sqlite3WalEndWriteTransaction(x) 0 |
||
89 | static int sqlite3WalEndWriteTransaction( Wal x ) |
||
90 | { |
||
91 | return 0; |
||
92 | } |
||
93 | |||
94 | //# define sqlite3WalUndo(x,y,z) 0 |
||
95 | static int sqlite3WalUndo( Wal x, int y, object z ) |
||
96 | { |
||
97 | return 0; |
||
98 | } |
||
99 | |||
100 | |||
101 | //# define sqlite3WalSavepoint(y,z) |
||
102 | static void sqlite3WalSavepoint( Wal y, object z ) |
||
103 | { |
||
104 | } |
||
105 | |||
106 | //# define sqlite3WalSavepointUndo(y,z) 0 |
||
107 | static int sqlite3WalSavepointUndo( Wal y, object z ) |
||
108 | { |
||
109 | return 0; |
||
110 | } |
||
111 | |||
112 | //# define sqlite3WalFrames(u,v,w,x,y,z) 0 |
||
113 | static int sqlite3WalFrames( Wal u, int v, PgHdr w, Pgno x, int y, int z ) |
||
114 | { |
||
115 | return 0; |
||
116 | } |
||
117 | |||
118 | //# define sqlite3WalCheckpoint(r,s,t,u,v,w,x,y,z) 0 |
||
119 | static int sqlite3WalCheckpoint( Wal r, int s, int t, u8[] u, int v, int w, u8[]x, ref int y, ref int z )//r,s,t,u,v,w,x,y,z |
||
120 | { |
||
121 | y = 0; |
||
122 | z = 0; |
||
123 | return 0; |
||
124 | } |
||
125 | |||
126 | //# define sqlite3WalCallback(z) 0 |
||
127 | static int sqlite3WalCallback( Wal z ) |
||
128 | { |
||
129 | return 0; |
||
130 | } |
||
131 | |||
132 | //# define sqlite3WalExclusiveMode(y,z) 0 |
||
133 | static bool sqlite3WalExclusiveMode( Wal y, int z ) |
||
134 | { |
||
135 | return false; |
||
136 | } |
||
137 | |||
138 | //# define sqlite3WalHeapMemory(z) 0 |
||
139 | static bool sqlite3WalHeapMemory( Wal z ) |
||
140 | { |
||
141 | return false; |
||
142 | } |
||
143 | |||
144 | #else |
||
145 | |||
146 | //#define WAL_SAVEPOINT_NDATA 4 |
||
147 | const int WAL_SAVEPOINT_NDATA = 4; |
||
148 | |||
149 | /* Connection to a write-ahead log (WAL) file. |
||
150 | ** There is one object of this type for each pager. |
||
151 | */ |
||
152 | typedef struct Wal Wal; |
||
153 | |||
154 | /* Open and close a connection to a write-ahead log. */ |
||
155 | int sqlite3WalOpen(sqlite3_vfs*, sqlite3_file*, string , int, i64, Wal*); |
||
156 | int sqlite3WalClose(Wal *pWal, int sync_flags, int, u8 ); |
||
157 | |||
158 | /* Set the limiting size of a WAL file. */ |
||
159 | void sqlite3WalLimit(Wal*, i64); |
||
160 | |||
161 | /* Used by readers to open (lock) and close (unlock) a snapshot. A |
||
162 | ** snapshot is like a read-transaction. It is the state of the database |
||
163 | ** at an instant in time. sqlite3WalOpenSnapshot gets a read lock and |
||
164 | ** preserves the current state even if the other threads or processes |
||
165 | ** write to or checkpoint the WAL. sqlite3WalCloseSnapshot() closes the |
||
166 | ** transaction and releases the lock. |
||
167 | */ |
||
168 | int sqlite3WalBeginReadTransaction(Wal *pWal, int ); |
||
169 | void sqlite3WalEndReadTransaction(Wal *pWal); |
||
170 | |||
171 | /* Read a page from the write-ahead log, if it is present. */ |
||
172 | int sqlite3WalRead(Wal *pWal, Pgno pgno, int *pInWal, int nOut, u8 *pOut); |
||
173 | |||
174 | /* If the WAL is not empty, return the size of the database. */ |
||
175 | Pgno sqlite3WalDbsize(Wal *pWal); |
||
176 | |||
177 | /* Obtain or release the WRITER lock. */ |
||
178 | int sqlite3WalBeginWriteTransaction(Wal *pWal); |
||
179 | int sqlite3WalEndWriteTransaction(Wal *pWal); |
||
180 | |||
181 | /* Undo any frames written (but not committed) to the log */ |
||
182 | int sqlite3WalUndo(Wal *pWal, int (*xUndo)(void *, Pgno), object *pUndoCtx); |
||
183 | |||
184 | /* Return an integer that records the current (uncommitted) write |
||
185 | ** position in the WAL */ |
||
186 | void sqlite3WalSavepoint(Wal *pWal, u32 *aWalData); |
||
187 | |||
188 | /* Move the write position of the WAL back to iFrame. Called in |
||
189 | ** response to a ROLLBACK TO command. */ |
||
190 | int sqlite3WalSavepointUndo(Wal *pWal, u32 *aWalData); |
||
191 | |||
192 | /* Write a frame or frames to the log. */ |
||
193 | int sqlite3WalFrames(Wal *pWal, int, PgHdr *, Pgno, int, int); |
||
194 | |||
195 | /* Copy pages from the log to the database file */ |
||
196 | int sqlite3WalCheckpoint( |
||
197 | Wal *pWal, /* Write-ahead log connection */ |
||
198 | int eMode, /* One of PASSIVE, FULL and RESTART */ |
||
199 | int (*xBusy)(void), /* Function to call when busy */ |
||
200 | void *pBusyArg, /* Context argument for xBusyHandler */ |
||
201 | int sync_flags, /* Flags to sync db file with (or 0) */ |
||
202 | int nBuf, /* Size of buffer nBuf */ |
||
203 | u8 *zBuf, /* Temporary buffer to use */ |
||
204 | int *pnLog, /* OUT: Number of frames in WAL */ |
||
205 | int *pnCkpt /* OUT: Number of backfilled frames in WAL */ |
||
206 | ); |
||
207 | |||
208 | /* Return the value to pass to a sqlite3_wal_hook callback, the |
||
209 | ** number of frames in the WAL at the point of the last commit since |
||
210 | ** sqlite3WalCallback() was called. If no commits have occurred since |
||
211 | ** the last call, then return 0. |
||
212 | */ |
||
213 | int sqlite3WalCallback(Wal *pWal); |
||
214 | |||
215 | /* Tell the wal layer that an EXCLUSIVE lock has been obtained (or released) |
||
216 | ** by the pager layer on the database file. |
||
217 | */ |
||
218 | int sqlite3WalExclusiveMode(Wal *pWal, int op); |
||
219 | |||
220 | /* Return true if the argument is non-NULL and the WAL module is using |
||
221 | ** heap-memory for the wal-index. Otherwise, if the argument is NULL or the |
||
222 | ** WAL module is using shared-memory, return false. |
||
223 | */ |
||
224 | int sqlite3WalHeapMemory(Wal *pWal); |
||
225 | |||
226 | #endif //* ifndef SQLITE_OMIT_WAL */ |
||
227 | //#endif //* _WAL_H_ */ |
||
228 | } |
||
229 | } |