Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: |
Downloads: |
Tarball
| ZIP archive
|
---|
Timelines: |
family
| ancestors
| descendants
| both
| trunk
|
Files: |
files
| file ages
| folders
|
SHA1: |
e9c2adbcbf5c28837b06e0fbba93f1764cc3607f |
User & Date: |
drh
2008-10-28 18:12:36.000 |
Context
2008-10-28
| | |
18:58 |
|
(check-in: 4651f590f0 user: drh tags: trunk)
|
18:12 |
|
(check-in: e9c2adbcbf user: drh tags: trunk)
|
17:52 |
|
(check-in: 679c0b35aa user: danielk1977 tags: trunk)
|
| | |
Changes
Changes to src/memjournal.c.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
-
+
+
+
+
+
-
+
-
-
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
-
-
+
+
+
+
+
+
-
+
|
/*
** 2007 August 22
** 2008 October 7
**
** The author disclaims copyright to this source code. In place of
** a legal notice, here is a blessing:
**
** May you do good and not evil.
** May you find forgiveness for yourself and forgive others.
** May you share freely, never taking more than you give.
**
*************************************************************************
**
** This file contains code use to implement an in-memory rollback journal.
** The in-memory rollback journal is used to journal transactions for
** ":memory:" databases and when the journal_mode=MEMORY pragma is used.
**
** @(#) $Id: memjournal.c,v 1.1 2008/10/17 19:13:05 danielk1977 Exp $
** @(#) $Id: memjournal.c,v 1.2 2008/10/28 18:12:36 drh Exp $
*/
#include "sqliteInt.h"
/* Forward references to internal structures */
typedef struct MemJournal MemJournal;
typedef struct FilePoint FilePoint;
typedef struct FileChunk FileChunk;
/* Space to hold the rollback journal is allocated in increments of
** this many bytes.
*/
#define JOURNAL_CHUNKSIZE 1024
/* Macro to find the minimum of two numeric values.
*/
#define MIN(x,y) ((x)<(y)?(x):(y))
/*
** The rollback journal is composed of a linked list of these structures.
*/
struct FileChunk {
FileChunk *pNext;
u8 zChunk[JOURNAL_CHUNKSIZE];
FileChunk *pNext; /* Next chunk in the journal */
u8 zChunk[JOURNAL_CHUNKSIZE]; /* Content of this chunk */
};
/*
** An instance of this object serves as a cursor into the rollback journal.
** The cursor can be either for reading or writing.
*/
struct FilePoint {
sqlite3_int64 iOffset;
FileChunk *pChunk;
sqlite3_int64 iOffset; /* Offset from the beginning of the file */
FileChunk *pChunk; /* Specific chunk into which cursor points */
};
/*
** This subclass is a subclass of sqlite3_file. Each open memory-journal
** is an instance of this class.
*/
struct MemJournal {
sqlite3_io_methods *pMethod; /* I/O methods on journal files */
sqlite3_io_methods *pMethod; /* Parent class. MUST BE FIRST */
FileChunk *pFirst; /* Head of in-memory chunk-list */
FilePoint endpoint; /* Pointer to the end of the file */
FilePoint readpoint; /* Pointer to the end of the last xRead() */
};
/*
** Read data from the file.
|
︙ | | |
215
216
217
218
219
220
221
222
223
|
234
235
236
237
238
239
240
|
-
-
|
/*
** Return the number of bytes required to store a MemJournal that uses vfs
** pVfs to create the underlying on-disk files.
*/
int sqlite3MemJournalSize(){
return sizeof(MemJournal);
}
|