add more test coverage; fix rekey bug related to MJ_PAGE_NO

This commit is contained in:
Stephen Lombardo
2008-08-10 22:39:35 -04:00
parent d9b3597d4b
commit 28585dbd6a
3 changed files with 71 additions and 6 deletions
+7 -5
View File
@@ -293,11 +293,13 @@ int sqlite3_rekey(sqlite3 *db, const void *pKey, int nKey) {
rc = sqlite3BtreeBeginTrans(pDb->pBt, 1); /* begin write transaction */
rc = sqlite3PagerPagecount(pPager, &page_count);
for(pgno = 1; rc == SQLITE_OK && pgno <= page_count; pgno++) { /* pgno's start at 1 see pager.c:pagerAcquire */
rc = sqlite3PagerGet(pPager, pgno, &page);
if(rc == SQLITE_OK) { /* write page see pager_incr_changecounter for example */
rc = sqlite3PagerWrite(page);
if(rc == SQLITE_OK) {
sqlite3PagerUnref(page);
if(!sqlite3pager_is_mj_pgno(pPager, pgno)) { /* skip this page (see pager.c:pagerAcquire for reasoning) */
rc = sqlite3PagerGet(pPager, pgno, &page);
if(rc == SQLITE_OK) { /* write page see pager_incr_changecounter for example */
rc = sqlite3PagerWrite(page);
if(rc == SQLITE_OK) {
sqlite3PagerUnref(page);
}
}
}
}
+3 -1
View File
@@ -5363,11 +5363,13 @@ i64 sqlite3PagerJournalSizeLimit(Pager *pPager, i64 iLimit){
/* BEGIN CRYPTO */
#ifdef SQLITE_HAS_CODEC
int sqlite3pager_get_codec(Pager *pPager, void **ctx) {
*ctx = pPager->pCodecArg;
}
int sqlite3pager_is_mj_pgno(Pager *pPager, Pgno pgno) {
return (PAGER_MJ_PGNO(pPager) == pgno) ? 1 : 0;
}
#endif
/* END CRYPTO */