OLD | NEW |
1 Index: src/btree.c | 1 diff --git a/third_party/sqlite/src/src/btree.c b/third_party/sqlite/src/src/btr
ee.c |
2 =================================================================== | 2 index f57f132..b5c3ba8 100644 |
3 --- src/btree.c»2009-09-09 06:45:19.000000000 -0700 | 3 --- a/third_party/sqlite/src/src/btree.c |
4 +++ src/btree.c»2009-09-14 18:17:53.000000000 -0700 | 4 +++ b/third_party/sqlite/src/src/btree.c |
5 @@ -24,6 +24,12 @@ | 5 @@ -22,6 +22,12 @@ |
6 static const char zMagicHeader[] = SQLITE_FILE_HEADER; | 6 static const char zMagicHeader[] = SQLITE_FILE_HEADER; |
7 | 7 |
8 /* | 8 /* |
9 +** The header string that appears at the beginning of a SQLite | 9 +** The header string that appears at the beginning of a SQLite |
10 +** database which has been poisoned. | 10 +** database which has been poisoned. |
11 +*/ | 11 +*/ |
12 +static const char zPoisonHeader[] = "SQLite poison 3"; | 12 +static const char zPoisonHeader[] = "SQLite poison 3"; |
13 + | 13 + |
14 +/* | 14 +/* |
15 ** Set this global variable to 1 to enable tracing using the TRACE | 15 ** Set this global variable to 1 to enable tracing using the TRACE |
16 ** macro. | 16 ** macro. |
17 */ | 17 */ |
18 @@ -2337,6 +2343,7 @@ | 18 @@ -2335,6 +2341,7 @@ static int lockBtree(BtShared *pBt){ |
19 if( rc ) return rc; | 19 ** in WAL mode. If the log is not already open, open it now. Then |
20 memcpy(data, zMagicHeader, sizeof(zMagicHeader)); | 20 ** return SQLITE_OK and return without populating BtShared.pPage1. |
21 assert( sizeof(zMagicHeader)==16 ); | 21 ** The caller detects this and calls this function again. This is |
22 + assert( sizeof(zMagicHeader)==sizeof(zPoisonHeader) ); | 22 + assert( sizeof(zMagicHeader)==sizeof(zPoisonHeader) ); |
23 put2byte(&data[16], pBt->pageSize); | 23 ** required as the version of page 1 currently in the page1 buffer |
24 data[18] = 1; | 24 ** may not be the latest version - there may be a newer one in the log |
25 data[19] = 1; | 25 ** file. |
26 @@ -7804,4 +7811,72 @@ | 26 @@ -7949,6 +7956,74 @@ int sqlite3BtreeCheckpoint(Btree *p){ |
27 assert(!pCur->aOverflow); | 27 } |
28 pCur->isIncrblobHandle = 1; | 28 return rc; |
29 } | 29 } |
30 + | 30 + |
31 +/* Poison the db so that other clients error out as quickly as | 31 +/* Poison the db so that other clients error out as quickly as |
32 +** possible. | 32 +** possible. |
33 +*/ | 33 +*/ |
34 +int sqlite3Poison(sqlite3 *db){ | 34 +int sqlite3Poison(sqlite3 *db){ |
35 + int rc; | 35 + int rc; |
36 + Btree *p; | 36 + Btree *p; |
37 + BtShared *pBt; | 37 + BtShared *pBt; |
38 + unsigned char *pP1; | 38 + unsigned char *pP1; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 + /* Push it to the database file. */ | 89 + /* Push it to the database file. */ |
90 + return sqlite3BtreeCommit(p); | 90 + return sqlite3BtreeCommit(p); |
91 + | 91 + |
92 + err: | 92 + err: |
93 + /* TODO(shess): What about errors, here? */ | 93 + /* TODO(shess): What about errors, here? */ |
94 + sqlite3BtreeRollback(p); | 94 + sqlite3BtreeRollback(p); |
95 + return rc; | 95 + return rc; |
96 +} | 96 +} |
97 + | 97 + |
98 #endif | 98 #endif |
| 99 |
| 100 /* |
OLD | NEW |