| OLD | NEW |
| 1 From ec588be0416fab3e957d0901eb6e638543b01229 Mon Sep 17 00:00:00 2001 | 1 From 29b8ad9263dbc700c002e9044c7c712a566a26d7 Mon Sep 17 00:00:00 2001 |
| 2 From: Scott Hess <shess@chromium.org> | 2 From: Scott Hess <shess@chromium.org> |
| 3 Date: Sat, 20 Jul 2013 11:42:21 -0700 | 3 Date: Sat, 20 Jul 2013 11:42:21 -0700 |
| 4 Subject: [PATCH 06/11] Virtual table supporting recovery of corrupted | 4 Subject: [PATCH 05/10] Virtual table supporting recovery of corrupted |
| 5 databases. | 5 databases. |
| 6 | 6 |
| 7 "recover" implements a virtual table which uses the SQLite pager layer | 7 "recover" implements a virtual table which uses the SQLite pager layer |
| 8 to read table pages and pull out the data which is structurally sound | 8 to read table pages and pull out the data which is structurally sound |
| 9 (at least at the storage layer). | 9 (at least at the storage layer). |
| 10 | 10 |
| 11 BUG=109482 | 11 BUG=109482 |
| 12 | 12 |
| 13 Since this implements a new feature for SQLite, the review URLs aren't | 13 Since this implements a new feature for SQLite, the review URLs aren't |
| 14 listed. This patch and the top of recover.c should be considered | 14 listed. This patch and the top of recover.c should be considered |
| 15 authoritative. The history is mostly under | 15 authoritative. The history is mostly under |
| 16 third_party/sqlite/src/src/{recover,recover-alt}.c . | 16 third_party/sqlite/src/src/{recover,recover-alt}.c . |
| 17 --- | 17 --- |
| 18 third_party/sqlite/src/Makefile.in | 1 + | 18 third_party/sqlite/src/Makefile.in | 1 + |
| 19 third_party/sqlite/src/Makefile.linux-gcc | 4 + | 19 third_party/sqlite/src/Makefile.linux-gcc | 4 + |
| 20 third_party/sqlite/src/main.mk | 4 +- | 20 third_party/sqlite/src/main.mk | 5 +- |
| 21 third_party/sqlite/src/src/main.c | 8 + | 21 third_party/sqlite/src/src/main.c | 8 + |
| 22 third_party/sqlite/src/src/recover.c | 2165 ++++++++++++++++++++++++++++ | 22 third_party/sqlite/src/src/recover.c | 2167 ++++++++++++++++++++++++++++ |
| 23 third_party/sqlite/src/src/sqlite.h.in | 16 + | 23 third_party/sqlite/src/src/sqlite.h.in | 16 + |
| 24 third_party/sqlite/src/test/recover.test | 147 ++ | 24 third_party/sqlite/src/test/recover.test | 147 ++ |
| 25 third_party/sqlite/src/test/recover0.test | 532 +++++++ | 25 third_party/sqlite/src/test/recover0.test | 532 +++++++ |
| 26 third_party/sqlite/src/test/recover1.test | 429 ++++++ | 26 third_party/sqlite/src/test/recover1.test | 429 ++++++ |
| 27 third_party/sqlite/src/test/recover2.test | 157 ++ | 27 third_party/sqlite/src/test/recover2.test | 157 ++ |
| 28 third_party/sqlite/src/tool/mksqlite3c.tcl | 2 + | 28 third_party/sqlite/src/tool/mksqlite3c.tcl | 2 + |
| 29 11 files changed, 3464 insertions(+), 1 deletion(-) | 29 11 files changed, 3467 insertions(+), 1 deletion(-) |
| 30 create mode 100644 third_party/sqlite/src/src/recover.c | 30 create mode 100644 third_party/sqlite/src/src/recover.c |
| 31 create mode 100644 third_party/sqlite/src/test/recover.test | 31 create mode 100644 third_party/sqlite/src/test/recover.test |
| 32 create mode 100644 third_party/sqlite/src/test/recover0.test | 32 create mode 100644 third_party/sqlite/src/test/recover0.test |
| 33 create mode 100644 third_party/sqlite/src/test/recover1.test | 33 create mode 100644 third_party/sqlite/src/test/recover1.test |
| 34 create mode 100644 third_party/sqlite/src/test/recover2.test | 34 create mode 100644 third_party/sqlite/src/test/recover2.test |
| 35 | 35 |
| 36 diff --git a/third_party/sqlite/src/Makefile.in b/third_party/sqlite/src/Makefil
e.in | 36 diff --git a/third_party/sqlite/src/Makefile.in b/third_party/sqlite/src/Makefil
e.in |
| 37 index a2213e8..1389486 100644 | 37 index 1fe49d6..8b965c7 100644 |
| 38 --- a/third_party/sqlite/src/Makefile.in | 38 --- a/third_party/sqlite/src/Makefile.in |
| 39 +++ b/third_party/sqlite/src/Makefile.in | 39 +++ b/third_party/sqlite/src/Makefile.in |
| 40 @@ -253,6 +253,7 @@ SRC = \ | 40 @@ -260,6 +260,7 @@ SRC = \ |
| 41 $(TOP)/src/prepare.c \ | 41 $(TOP)/src/prepare.c \ |
| 42 $(TOP)/src/printf.c \ | 42 $(TOP)/src/printf.c \ |
| 43 $(TOP)/src/random.c \ | 43 $(TOP)/src/random.c \ |
| 44 + $(TOP)/src/recover.c \ | 44 + $(TOP)/src/recover.c \ |
| 45 $(TOP)/src/resolve.c \ | 45 $(TOP)/src/resolve.c \ |
| 46 $(TOP)/src/rowset.c \ | 46 $(TOP)/src/rowset.c \ |
| 47 $(TOP)/src/select.c \ | 47 $(TOP)/src/select.c \ |
| 48 diff --git a/third_party/sqlite/src/Makefile.linux-gcc b/third_party/sqlite/src/
Makefile.linux-gcc | 48 diff --git a/third_party/sqlite/src/Makefile.linux-gcc b/third_party/sqlite/src/
Makefile.linux-gcc |
| 49 index 4f6cdf1..dd8f46d 100644 | 49 index 952e8d1..f6291c0 100644 |
| 50 --- a/third_party/sqlite/src/Makefile.linux-gcc | 50 --- a/third_party/sqlite/src/Makefile.linux-gcc |
| 51 +++ b/third_party/sqlite/src/Makefile.linux-gcc | 51 +++ b/third_party/sqlite/src/Makefile.linux-gcc |
| 52 @@ -81,6 +81,10 @@ OPTS += -DSQLITE_MEMDEBUG=1 | 52 @@ -81,6 +81,10 @@ OPTS += -DSQLITE_MEMDEBUG=1 |
| 53 # TODO(shess) I can't see why I need this setting. | 53 # TODO(shess) I can't see why I need this setting. |
| 54 OPTS += -DOS_UNIX=1 | 54 OPTS += -DOS_UNIX=1 |
| 55 | 55 |
| 56 +# The recover virtual table is not generally enabled. Enable it for testing | 56 +# The recover virtual table is not generally enabled. Enable it for testing |
| 57 +# purposes. | 57 +# purposes. |
| 58 +OPTS += -DDEFAULT_ENABLE_RECOVER=1 | 58 +OPTS += -DDEFAULT_ENABLE_RECOVER=1 |
| 59 + | 59 + |
| 60 #### The suffix to add to executable files. ".exe" for windows. | 60 #### The suffix to add to executable files. ".exe" for windows. |
| 61 # Nothing for unix. | 61 # Nothing for unix. |
| 62 # | 62 # |
| 63 diff --git a/third_party/sqlite/src/main.mk b/third_party/sqlite/src/main.mk | 63 diff --git a/third_party/sqlite/src/main.mk b/third_party/sqlite/src/main.mk |
| 64 index dc56b0d..2189fd6 100644 | 64 index 6ff3bd4..a8629aa 100644 |
| 65 --- a/third_party/sqlite/src/main.mk | 65 --- a/third_party/sqlite/src/main.mk |
| 66 +++ b/third_party/sqlite/src/main.mk | 66 +++ b/third_party/sqlite/src/main.mk |
| 67 @@ -65,7 +65,7 @@ LIBOBJ+= vdbe.o parse.o \ | 67 @@ -67,7 +67,8 @@ LIBOBJ+= vdbe.o parse.o \ |
| 68 mutex.o mutex_noop.o mutex_unix.o mutex_w32.o \ | 68 mutex.o mutex_noop.o mutex_unix.o mutex_w32.o \ |
| 69 notify.o opcodes.o os.o os_unix.o os_win.o \ | 69 notify.o opcodes.o os.o os_unix.o os_win.o \ |
| 70 pager.o pcache.o pcache1.o pragma.o prepare.o printf.o \ | 70 pager.o pcache.o pcache1.o pragma.o prepare.o printf.o \ |
| 71 - random.o resolve.o rowset.o rtree.o select.o status.o \ | 71 - random.o resolve.o rowset.o rtree.o select.o sqlite3rbu.o status.o \ |
| 72 + random.o recover.o resolve.o rowset.o rtree.o select.o status.o \ | 72 + random.o recover.o resolve.o rowset.o rtree.o \ |
| 73 table.o threads.o tokenize.o trigger.o \ | 73 + select.o sqlite3rbu.o status.o \ |
| 74 table.o threads.o tokenize.o treeview.o trigger.o \ |
| 74 update.o userauth.o util.o vacuum.o \ | 75 update.o userauth.o util.o vacuum.o \ |
| 75 vdbeapi.o vdbeaux.o vdbeblob.o vdbemem.o vdbesort.o \ | 76 vdbeapi.o vdbeaux.o vdbeblob.o vdbemem.o vdbesort.o \ |
| 76 @@ -135,6 +135,7 @@ SRC = \ | 77 @@ -140,6 +141,7 @@ SRC = \ |
| 77 $(TOP)/src/prepare.c \ | 78 $(TOP)/src/prepare.c \ |
| 78 $(TOP)/src/printf.c \ | 79 $(TOP)/src/printf.c \ |
| 79 $(TOP)/src/random.c \ | 80 $(TOP)/src/random.c \ |
| 80 + $(TOP)/src/recover.c \ | 81 + $(TOP)/src/recover.c \ |
| 81 $(TOP)/src/resolve.c \ | 82 $(TOP)/src/resolve.c \ |
| 82 $(TOP)/src/rowset.c \ | 83 $(TOP)/src/rowset.c \ |
| 83 $(TOP)/src/select.c \ | 84 $(TOP)/src/select.c \ |
| 84 @@ -315,6 +316,7 @@ TESTSRC2 = \ | 85 @@ -360,6 +362,7 @@ TESTSRC2 = \ |
| 85 $(TOP)/src/prepare.c \ | 86 $(TOP)/src/prepare.c \ |
| 86 $(TOP)/src/printf.c \ | 87 $(TOP)/src/printf.c \ |
| 87 $(TOP)/src/random.c \ | 88 $(TOP)/src/random.c \ |
| 88 + $(TOP)/src/recover.c \ | 89 + $(TOP)/src/recover.c \ |
| 89 $(TOP)/src/pcache.c \ | 90 $(TOP)/src/pcache.c \ |
| 90 $(TOP)/src/pcache1.c \ | 91 $(TOP)/src/pcache1.c \ |
| 91 $(TOP)/src/select.c \ | 92 $(TOP)/src/select.c \ |
| 92 diff --git a/third_party/sqlite/src/src/main.c b/third_party/sqlite/src/src/main
.c | 93 diff --git a/third_party/sqlite/src/src/main.c b/third_party/sqlite/src/src/main
.c |
| 93 index fc03700..d15ab9bb 100644 | 94 index 3be7c77..301808c 100644 |
| 94 --- a/third_party/sqlite/src/src/main.c | 95 --- a/third_party/sqlite/src/src/main.c |
| 95 +++ b/third_party/sqlite/src/src/main.c | 96 +++ b/third_party/sqlite/src/src/main.c |
| 96 @@ -2644,6 +2644,14 @@ static int openDatabase( | 97 @@ -2927,6 +2927,14 @@ static int openDatabase( |
| 97 } | 98 } |
| 98 #endif | 99 #endif |
| 99 | 100 |
| 100 +#ifdef DEFAULT_ENABLE_RECOVER | 101 +#ifdef DEFAULT_ENABLE_RECOVER |
| 101 + /* Initialize recover virtual table for testing. */ | 102 + /* Initialize recover virtual table for testing. */ |
| 102 + extern int recoverVtableInit(sqlite3 *db); | 103 + extern int recoverVtableInit(sqlite3 *db); |
| 103 + if( !db->mallocFailed && rc==SQLITE_OK ){ | 104 + if( !db->mallocFailed && rc==SQLITE_OK ){ |
| 104 + rc = recoverVtableInit(db); | 105 + rc = recoverVtableInit(db); |
| 105 + } | 106 + } |
| 106 +#endif | 107 +#endif |
| 107 + | 108 + |
| 108 #ifdef SQLITE_ENABLE_ICU | 109 #ifdef SQLITE_ENABLE_ICU |
| 109 if( !db->mallocFailed && rc==SQLITE_OK ){ | 110 if( !db->mallocFailed && rc==SQLITE_OK ){ |
| 110 rc = sqlite3IcuInit(db); | 111 rc = sqlite3IcuInit(db); |
| 111 diff --git a/third_party/sqlite/src/src/recover.c b/third_party/sqlite/src/src/r
ecover.c | 112 diff --git a/third_party/sqlite/src/src/recover.c b/third_party/sqlite/src/src/r
ecover.c |
| 112 new file mode 100644 | 113 new file mode 100644 |
| 113 index 0000000..6882d6f | 114 index 0000000..8e3929d |
| 114 --- /dev/null | 115 --- /dev/null |
| 115 +++ b/third_party/sqlite/src/src/recover.c | 116 +++ b/third_party/sqlite/src/src/recover.c |
| 116 @@ -0,0 +1,2165 @@ | 117 @@ -0,0 +1,2167 @@ |
| 117 +/* | 118 +/* |
| 118 +** 2012 Jan 11 | 119 +** 2012 Jan 11 |
| 119 +** | 120 +** |
| 120 +** The author disclaims copyright to this source code. In place of | 121 +** The author disclaims copyright to this source code. In place of |
| 121 +** a legal notice, here is a blessing: | 122 +** a legal notice, here is a blessing: |
| 122 +** | 123 +** |
| 123 +** May you do good and not evil. | 124 +** May you do good and not evil. |
| 124 +** May you find forgiveness for yourself and forgive others. | 125 +** May you find forgiveness for yourself and forgive others. |
| 125 +** May you share freely, never taking more than you give. | 126 +** May you share freely, never taking more than you give. |
| 126 +*/ | 127 +*/ |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 +#include <ctype.h> | 329 +#include <ctype.h> |
| 329 +#include <stdio.h> | 330 +#include <stdio.h> |
| 330 +#include <string.h> | 331 +#include <string.h> |
| 331 + | 332 + |
| 332 +/* Internal SQLite things that are used: | 333 +/* Internal SQLite things that are used: |
| 333 + * u32, u64, i64 types. | 334 + * u32, u64, i64 types. |
| 334 + * Btree, Pager, and DbPage structs. | 335 + * Btree, Pager, and DbPage structs. |
| 335 + * DbPage.pData, .pPager, and .pgno | 336 + * DbPage.pData, .pPager, and .pgno |
| 336 + * sqlite3 struct. | 337 + * sqlite3 struct. |
| 337 + * sqlite3BtreePager() and sqlite3BtreeGetPageSize() | 338 + * sqlite3BtreePager() and sqlite3BtreeGetPageSize() |
| 338 + * sqlite3PagerAcquire() and sqlite3PagerUnref() | 339 + * sqlite3BtreeGetOptimalReserve() |
| 340 + * sqlite3PagerGet() and sqlite3PagerUnref() |
| 339 + * getVarint(). | 341 + * getVarint(). |
| 340 + */ | 342 + */ |
| 341 +#include "sqliteInt.h" | 343 +#include "sqliteInt.h" |
| 342 + | 344 + |
| 343 +/* For debugging. */ | 345 +/* For debugging. */ |
| 344 +#if 0 | 346 +#if 0 |
| 345 +#define FNENTRY() fprintf(stderr, "In %s\n", __FUNCTION__) | 347 +#define FNENTRY() fprintf(stderr, "In %s\n", __FUNCTION__) |
| 346 +#else | 348 +#else |
| 347 +#define FNENTRY() | 349 +#define FNENTRY() |
| 348 +#endif | 350 +#endif |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 514 + if( ascii_strcasecmp(db->aDb[i].zName, zName)==0 ){ | 516 + if( ascii_strcasecmp(db->aDb[i].zName, zName)==0 ){ |
| 515 + pBt = db->aDb[i].pBt; | 517 + pBt = db->aDb[i].pBt; |
| 516 + break; | 518 + break; |
| 517 + } | 519 + } |
| 518 + } | 520 + } |
| 519 + if( !pBt ){ | 521 + if( !pBt ){ |
| 520 + return SQLITE_ERROR; | 522 + return SQLITE_ERROR; |
| 521 + } | 523 + } |
| 522 + | 524 + |
| 523 + *pPager = sqlite3BtreePager(pBt); | 525 + *pPager = sqlite3BtreePager(pBt); |
| 524 + *pnPageSize = sqlite3BtreeGetPageSize(pBt) - sqlite3BtreeGetReserve(pBt); | 526 + *pnPageSize = |
| 527 + sqlite3BtreeGetPageSize(pBt) - sqlite3BtreeGetOptimalReserve(pBt); |
| 525 + return SQLITE_OK; | 528 + return SQLITE_OK; |
| 526 +} | 529 +} |
| 527 + | 530 + |
| 528 +/* iSerialType is a type read from a record header. See "2.1 Record Format". | 531 +/* iSerialType is a type read from a record header. See "2.1 Record Format". |
| 529 + */ | 532 + */ |
| 530 + | 533 + |
| 531 +/* Storage size of iSerialType in bytes. My interpretation of SQLite | 534 +/* Storage size of iSerialType in bytes. My interpretation of SQLite |
| 532 + * documentation is that text and blob fields can have 32-bit length. | 535 + * documentation is that text and blob fields can have 32-bit length. |
| 533 + * Values past 2^31-12 will need more than 32 bits to encode, which is | 536 + * Values past 2^31-12 will need more than 32 bits to encode, which is |
| 534 + * why iSerialType is u64. | 537 + * why iSerialType is u64. |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 886 + int rc; | 889 + int rc; |
| 887 + const unsigned char *pPageHeader; /* Header of found page. */ | 890 + const unsigned char *pPageHeader; /* Header of found page. */ |
| 888 + | 891 + |
| 889 + /* Find a valid child page which isn't on the stack. */ | 892 + /* Find a valid child page which isn't on the stack. */ |
| 890 + while( pCursor->iChild<pCursor->nChildren ){ | 893 + while( pCursor->iChild<pCursor->nChildren ){ |
| 891 + const unsigned iPage = interiorCursorChildPage(pCursor); | 894 + const unsigned iPage = interiorCursorChildPage(pCursor); |
| 892 + pCursor->iChild++; | 895 + pCursor->iChild++; |
| 893 + if( interiorCursorPageInUse(pCursor, iPage) ){ | 896 + if( interiorCursorPageInUse(pCursor, iPage) ){ |
| 894 + fprintf(stderr, "Loop detected at %d\n", iPage); | 897 + fprintf(stderr, "Loop detected at %d\n", iPage); |
| 895 + }else{ | 898 + }else{ |
| 896 + int rc = sqlite3PagerAcquire(pCursor->pPage->pPager, iPage, ppPage, 0); | 899 + int rc = sqlite3PagerGet(pCursor->pPage->pPager, iPage, ppPage, 0); |
| 897 + if( rc==SQLITE_OK ){ | 900 + if( rc==SQLITE_OK ){ |
| 898 + return SQLITE_ROW; | 901 + return SQLITE_ROW; |
| 899 + } | 902 + } |
| 900 + } | 903 + } |
| 901 + } | 904 + } |
| 902 + | 905 + |
| 903 + /* This page has no more children. Get next page from parent. */ | 906 + /* This page has no more children. Get next page from parent. */ |
| 904 + if( !pCursor->pParent ){ | 907 + if( !pCursor->pParent ){ |
| 905 + return SQLITE_DONE; | 908 + return SQLITE_DONE; |
| 906 + } | 909 + } |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1030 + nBytes = nLocalRecordBytes; | 1033 + nBytes = nLocalRecordBytes; |
| 1031 + | 1034 + |
| 1032 + /* While there are more pages to read, and more bytes are needed, | 1035 + /* While there are more pages to read, and more bytes are needed, |
| 1033 + * get another page. | 1036 + * get another page. |
| 1034 + */ | 1037 + */ |
| 1035 + pFirstOverflow = pLastOverflow = NULL; | 1038 + pFirstOverflow = pLastOverflow = NULL; |
| 1036 + rc = SQLITE_OK; | 1039 + rc = SQLITE_OK; |
| 1037 + while( iNextPage && nBytes<nRecordBytes ){ | 1040 + while( iNextPage && nBytes<nRecordBytes ){ |
| 1038 + RecoverOverflow *pOverflow; /* New overflow page for the list. */ | 1041 + RecoverOverflow *pOverflow; /* New overflow page for the list. */ |
| 1039 + | 1042 + |
| 1040 + rc = sqlite3PagerAcquire(pPage->pPager, iNextPage, &pPage, 0); | 1043 + rc = sqlite3PagerGet(pPage->pPager, iNextPage, &pPage, 0); |
| 1041 + if( rc!=SQLITE_OK ){ | 1044 + if( rc!=SQLITE_OK ){ |
| 1042 + break; | 1045 + break; |
| 1043 + } | 1046 + } |
| 1044 + | 1047 + |
| 1045 + pOverflow = sqlite3_malloc(sizeof(RecoverOverflow)); | 1048 + pOverflow = sqlite3_malloc(sizeof(RecoverOverflow)); |
| 1046 + if( !pOverflow ){ | 1049 + if( !pOverflow ){ |
| 1047 + sqlite3PagerUnref(pPage); | 1050 + sqlite3PagerUnref(pPage); |
| 1048 + rc = SQLITE_NOMEM; | 1051 + rc = SQLITE_NOMEM; |
| 1049 + break; | 1052 + break; |
| 1050 + } | 1053 + } |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1359 + * - pPage is a valid interior page who's leaves contain no valid cells. | 1362 + * - pPage is a valid interior page who's leaves contain no valid cells. |
| 1360 + * - pPage is not a valid leaf or interior page. | 1363 + * - pPage is not a valid leaf or interior page. |
| 1361 + */ | 1364 + */ |
| 1362 +static int leafCursorCreate(Pager *pPager, unsigned nPageSize, | 1365 +static int leafCursorCreate(Pager *pPager, unsigned nPageSize, |
| 1363 + u32 iRootPage, RecoverLeafCursor **ppCursor){ | 1366 + u32 iRootPage, RecoverLeafCursor **ppCursor){ |
| 1364 + DbPage *pPage; /* Reference to page at iRootPage. */ | 1367 + DbPage *pPage; /* Reference to page at iRootPage. */ |
| 1365 + RecoverLeafCursor *pCursor; /* Leaf cursor being constructed. */ | 1368 + RecoverLeafCursor *pCursor; /* Leaf cursor being constructed. */ |
| 1366 + int rc; | 1369 + int rc; |
| 1367 + | 1370 + |
| 1368 + /* Start out with the root page. */ | 1371 + /* Start out with the root page. */ |
| 1369 + rc = sqlite3PagerAcquire(pPager, iRootPage, &pPage, 0); | 1372 + rc = sqlite3PagerGet(pPager, iRootPage, &pPage, 0); |
| 1370 + if( rc!=SQLITE_OK ){ | 1373 + if( rc!=SQLITE_OK ){ |
| 1371 + return rc; | 1374 + return rc; |
| 1372 + } | 1375 + } |
| 1373 + | 1376 + |
| 1374 + pCursor = sqlite3_malloc(sizeof(RecoverLeafCursor)); | 1377 + pCursor = sqlite3_malloc(sizeof(RecoverLeafCursor)); |
| 1375 + if( !pCursor ){ | 1378 + if( !pCursor ){ |
| 1376 + sqlite3PagerUnref(pPage); | 1379 + sqlite3PagerUnref(pPage); |
| 1377 + return SQLITE_NOMEM; | 1380 + return SQLITE_NOMEM; |
| 1378 + } | 1381 + } |
| 1379 + memset(pCursor, 0, sizeof(*pCursor)); | 1382 + memset(pCursor, 0, sizeof(*pCursor)); |
| (...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2273 + sqlite3_free(zCreateSql); | 2276 + sqlite3_free(zCreateSql); |
| 2274 + if( rc!=SQLITE_OK ){ | 2277 + if( rc!=SQLITE_OK ){ |
| 2275 + recoverRelease(pRecover); | 2278 + recoverRelease(pRecover); |
| 2276 + return rc; | 2279 + return rc; |
| 2277 + } | 2280 + } |
| 2278 + | 2281 + |
| 2279 + *ppVtab = (sqlite3_vtab *)pRecover; | 2282 + *ppVtab = (sqlite3_vtab *)pRecover; |
| 2280 + return SQLITE_OK; | 2283 + return SQLITE_OK; |
| 2281 +} | 2284 +} |
| 2282 diff --git a/third_party/sqlite/src/src/sqlite.h.in b/third_party/sqlite/src/src
/sqlite.h.in | 2285 diff --git a/third_party/sqlite/src/src/sqlite.h.in b/third_party/sqlite/src/src
/sqlite.h.in |
| 2283 index 36aa999..333adfe 100644 | 2286 index e5673fd..6829bcb 100644 |
| 2284 --- a/third_party/sqlite/src/src/sqlite.h.in | 2287 --- a/third_party/sqlite/src/src/sqlite.h.in |
| 2285 +++ b/third_party/sqlite/src/src/sqlite.h.in | 2288 +++ b/third_party/sqlite/src/src/sqlite.h.in |
| 2286 @@ -7408,6 +7408,22 @@ int sqlite3_vtab_on_conflict(sqlite3 *); | 2289 @@ -7411,6 +7411,22 @@ int sqlite3_strnicmp(const char *, const char *, int); |
| 2287 | 2290 */ |
| 2288 | 2291 int sqlite3_strglob(const char *zGlob, const char *zStr); |
| 2289 | 2292 |
| 2290 +/* Begin recover virtual table patch for Chromium */ | 2293 +/* Begin recover virtual table patch for Chromium */ |
| 2291 +/* Our patches don't conform to SQLite's amalgamation processing. Hack it. */ | 2294 +/* Our patches don't conform to SQLite's amalgamation processing. Hack it. */ |
| 2292 +#ifndef CHROMIUM_SQLITE_API | 2295 +#ifndef CHROMIUM_SQLITE_API |
| 2293 +#define CHROMIUM_SQLITE_API SQLITE_API | 2296 +#define CHROMIUM_SQLITE_API SQLITE_API |
| 2294 +#endif | 2297 +#endif |
| 2295 +/* | 2298 +/* |
| 2296 +** Call to initialize the recover virtual-table modules (see recover.c). | 2299 +** Call to initialize the recover virtual-table modules (see recover.c). |
| 2297 +** | 2300 +** |
| 2298 +** This could be loaded by default in main.c, but that would make the | 2301 +** This could be loaded by default in main.c, but that would make the |
| (...skipping 1290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3589 + | 3592 + |
| 3590 + execsql { | 3593 + execsql { |
| 3591 + PRAGMA page_count; | 3594 + PRAGMA page_count; |
| 3592 + PRAGMA page_size; | 3595 + PRAGMA page_size; |
| 3593 + SELECT rowid, TYPEOF(value), length(value), value FROM overflow_recover; | 3596 + SELECT rowid, TYPEOF(value), length(value), value FROM overflow_recover; |
| 3594 + } | 3597 + } |
| 3595 +} [list 4 1024 1 text [string length $substr] $substr] | 3598 +} [list 4 1024 1 text [string length $substr] $substr] |
| 3596 + | 3599 + |
| 3597 +finish_test | 3600 +finish_test |
| 3598 diff --git a/third_party/sqlite/src/tool/mksqlite3c.tcl b/third_party/sqlite/src
/tool/mksqlite3c.tcl | 3601 diff --git a/third_party/sqlite/src/tool/mksqlite3c.tcl b/third_party/sqlite/src
/tool/mksqlite3c.tcl |
| 3599 index 0e97923..9e2b0fe 100644 | 3602 index 23241e2..1113758 100644 |
| 3600 --- a/third_party/sqlite/src/tool/mksqlite3c.tcl | 3603 --- a/third_party/sqlite/src/tool/mksqlite3c.tcl |
| 3601 +++ b/third_party/sqlite/src/tool/mksqlite3c.tcl | 3604 +++ b/third_party/sqlite/src/tool/mksqlite3c.tcl |
| 3602 @@ -316,6 +316,8 @@ foreach file { | 3605 @@ -361,6 +361,8 @@ foreach file { |
| 3603 main.c | 3606 main.c |
| 3604 notify.c | 3607 notify.c |
| 3605 | 3608 |
| 3606 + recover.c | 3609 + recover.c |
| 3607 + | 3610 + |
| 3608 fts3.c | 3611 fts3.c |
| 3609 fts3_aux.c | 3612 fts3_aux.c |
| 3610 fts3_expr.c | 3613 fts3_expr.c |
| 3611 -- | 3614 -- |
| 3612 2.4.5 | 3615 2.7.0 |
| 3613 | 3616 |
| OLD | NEW |