line |
true |
false |
branch |
319
|
17 |
0 |
if( rc==SQLITE_OK && format>JOURNAL_FORMAT_1 ){ |
|
17 |
0 |
if( rc==SQLITE_OK && format>JOURNAL_FORMAT_1 ){ |
376
|
0 |
0 |
if( pPager->errMask & PAGER_ERR_LOCK ) rc = SQLITE_PROTOCOL; |
377
|
0 |
0 |
if( pPager->errMask & PAGER_ERR_DISK ) rc = SQLITE_IOERR; |
378
|
0 |
0 |
if( pPager->errMask & PAGER_ERR_FULL ) rc = SQLITE_FULL; |
379
|
0 |
0 |
if( pPager->errMask & PAGER_ERR_MEM ) rc = SQLITE_NOMEM; |
380
|
0 |
0 |
if( pPager->errMask & PAGER_ERR_CORRUPT ) rc = SQLITE_CORRUPT; |
395
|
0 |
0 |
if( pPg->inCkpt ) return; |
398
|
0 |
0 |
if( pPager->pCkpt ){ |
406
|
634 |
0 |
if( !pPg->inCkpt ) return; |
407
|
0 |
0 |
if( pPg->pPrevCkpt ){ |
414
|
0 |
0 |
if( pPg->pNextCkpt ){ |
429
|
768 |
375 |
while( p && p->pgno!=pgno ){ |
|
0 |
768 |
while( p && p->pgno!=pgno ){ |
443
|
628 |
256 |
for(pPg=pPager->pAll; pPg; pPg=pNext){ |
453
|
0 |
256 |
if( pPager->state>=SQLITE_WRITELOCK ){ |
476
|
0 |
156 |
if( pPager->state
|
478
|
0 |
156 |
if( pPager->ckptOpen ){ |
482
|
98 |
58 |
if( pPager->journalOpen ){ |
488
|
321 |
98 |
for(pPg=pPager->pAll; pPg; pPg=pPg->pNextAll){ |
497
|
156 |
0 |
if( rc==SQLITE_OK ){ |
535
|
0 |
4 |
if( rc!=SQLITE_OK ) return rc; |
537
|
0 |
4 |
if( rc!=SQLITE_OK ) return rc; |
544
|
0 |
4 |
if( pgRec.pgno==0 ){ |
547
|
0 |
4 |
if( pgRec.pgno>(unsigned)pPager->dbSize ){ |
550
|
4 |
0 |
if( format>=JOURNAL_FORMAT_3 ){ |
552
|
0 |
4 |
if( rc ) return rc; |
553
|
0 |
4 |
if( pager_cksum(pPager, pgRec.pgno, pgRec.aData)!=cksum ){ |
565
|
4 |
0 |
if( pPg ){ |
647
|
0 |
3 |
if( rc!=SQLITE_OK ){ |
657
|
0 |
3 |
if( szJ < sizeof(aMagic)+sizeof(Pgno) ){ |
665
|
0 |
3 |
if( rc!=SQLITE_OK ){ |
669
|
3 |
0 |
if( memcmp(aMagic, aJournalMagic3, sizeof(aMagic))==0 ){ |
671
|
0 |
0 |
}else if( memcmp(aMagic, aJournalMagic2, sizeof(aMagic))==0 ){ |
673
|
0 |
0 |
}else if( memcmp(aMagic, aJournalMagic1, sizeof(aMagic))==0 ){ |
679
|
3 |
0 |
if( format>=JOURNAL_FORMAT_3 ){ |
680
|
0 |
3 |
if( szJ < sizeof(aMagic) + 3*sizeof(u32) ){ |
690
|
0 |
3 |
if( rc ) goto end_playback; |
692
|
0 |
3 |
if( rc ) goto end_playback; |
693
|
3 |
0 |
if( nRec==0xffffffff || useJournalSize ){ |
|
3 |
0 |
if( nRec==0xffffffff || useJournalSize ){ |
701
|
0 |
3 |
if( rc!=SQLITE_OK ){ |
706
|
0 |
3 |
if( rc!=SQLITE_OK ){ |
713
|
4 |
3 |
for(i=0; i
|
715
|
0 |
4 |
if( rc!=SQLITE_OK ){ |
716
|
0 |
0 |
if( rc==SQLITE_DONE ){ |
727
|
3 |
0 |
if( rc==SQLITE_OK ){ |
729
|
7 |
3 |
for(pPg=pPager->pAll; pPg; pPg=pPg->pNextAll){ |
731
|
7 |
0 |
if( !pPg->dirty ) continue; |
732
|
0 |
0 |
if( (int)pPg->pgno <= pPager->origDbSize ){ |
737
|
0 |
0 |
if( rc ) break; |
741
|
0 |
0 |
if( pPg->nRef==0 || memcmp(zBuf, PGHDR_TO_DATA(pPg), SQLITE_PAGE_SIZE) ){ |
|
0 |
0 |
if( pPg->nRef==0 || memcmp(zBuf, PGHDR_TO_DATA(pPg), SQLITE_PAGE_SIZE) ){ |
751
|
0 |
3 |
if( rc!=SQLITE_OK ){ |
797
|
0 |
0 |
for(i=nRec-1; i>=0; i--){ |
800
|
0 |
0 |
if( rc!=SQLITE_OK ) goto end_ckpt_playback; |
807
|
0 |
0 |
if( rc!=SQLITE_OK ){ |
811
|
0 |
0 |
if( rc!=SQLITE_OK ){ |
815
|
0 |
0 |
for(i=nRec-1; i>=0; i--){ |
817
|
0 |
0 |
if( rc!=SQLITE_OK ){ |
824
|
0 |
0 |
if( rc!=SQLITE_OK ){ |
842
|
54 |
0 |
if( mxPage>=0 ){ |
844
|
27 |
27 |
if( pPager->noSync==0 ) pPager->needSync = 0; |
849
|
54 |
0 |
if( mxPage>10 ){ |
881
|
54 |
0 |
pPager->noSync = level==1 || pPager->tempFile; |
|
27 |
27 |
pPager->noSync = level==1 || pPager->tempFile; |
882
|
0 |
54 |
pPager->fullSync = level==3 && !pPager->tempFile; |
|
0 |
0 |
pPager->fullSync = level==3 && !pPager->tempFile; |
883
|
27 |
27 |
if( pPager->noSync==0 ) pPager->needSync = 0; |
902
|
28 |
0 |
}while( cnt>0 && rc!=SQLITE_OK ); |
|
0 |
28 |
}while( cnt>0 && rc!=SQLITE_OK ); |
933
|
0 |
53 |
if( sqlite_malloc_failed ){ |
936
|
25 |
28 |
if( zFilename && zFilename[0] ){ |
|
25 |
0 |
if( zFilename && zFilename[0] ){ |
946
|
0 |
53 |
if( sqlite_malloc_failed ){ |
949
|
0 |
53 |
if( rc!=SQLITE_OK ){ |
955
|
0 |
53 |
if( pPager==0 ){ |
966
|
744 |
0 |
for(i=nameLen; i>0 && pPager->zDirectory[i-1]!='/'; i--){} |
|
691 |
53 |
for(i=nameLen; i>0 && pPager->zDirectory[i-1]!='/'; i--){} |
967
|
53 |
0 |
if( i>0 ) pPager->zDirectory[i-1] = 0; |
981
|
53 |
0 |
pPager->mxPage = mxPage>5 ? mxPage : 10; |
987
|
25 |
28 |
pPager->noSync = pPager->tempFile || !useJournal; |
|
0 |
25 |
pPager->noSync = pPager->tempFile || !useJournal; |
1016
|
565 |
259 |
if( pPager->dbSize>=0 ){ |
1019
|
0 |
259 |
if( sqliteOsFileSize(&pPager->fd, &n)!=SQLITE_OK ){ |
1024
|
259 |
0 |
if( pPager->state!=SQLITE_UNLOCK ){ |
1040
|
0 |
0 |
if( pPager->dbSize<0 ){ |
1043
|
0 |
0 |
if( pPager->errMask!=0 ){ |
1047
|
0 |
0 |
if( nPage>=(unsigned)pPager->dbSize ){ |
1052
|
0 |
0 |
if( rc==SQLITE_OK ){ |
1085
|
6 |
53 |
for(pPg=pPager->pAll; pPg; pPg=pNext){ |
1097
|
0 |
53 |
if( pPager->zFilename!=(char*)&pPager[1] ){ |
1122
|
60 |
0 |
if( pPg->nRef==0 ){ |
1124
|
15 |
45 |
if( pPg==pPg->pPager->pFirstSynced ){ |
1126
|
0 |
15 |
while( p && p->needSync ){ p = p->pNextFree; } |
|
0 |
0 |
while( p && p->needSync ){ p = p->pNextFree; } |
1129
|
37 |
23 |
if( pPg->pPrevFree ){ |
1134
|
32 |
28 |
if( pPg->pNextFree ){ |
1151
|
0 |
12 |
page_ref(pPg); |
1182
|
68 |
23 |
if( pPager->needSync ){ |
1183
|
68 |
0 |
if( !pPager->tempFile ){ |
1203
|
0 |
68 |
if( pPager->fullSync ){ |
1206
|
0 |
0 |
if( rc!=0 ) return rc; |
1210
|
0 |
68 |
if( rc ) return rc; |
1217
|
0 |
68 |
if( rc!=0 ) return rc; |
1224
|
257 |
68 |
for(pPg=pPager->pAll; pPg; pPg=pPg->pNextAll){ |
1255
|
0 |
91 |
if( pList==0 ) return SQLITE_OK; |
1257
|
225 |
91 |
while( pList ){ |
1264
|
0 |
225 |
if( rc ) return rc; |
1279
|
304 |
91 |
for(p=pPager->pAll; p; p=p->pNextAll){ |
1280
|
225 |
79 |
if( p->dirty ){ |
1320
|
0 |
1356 |
if( pPager->errMask & ~(PAGER_ERR_FULL) ){ |
1327
|
259 |
1097 |
if( pPager->nRef==0 ){ |
1329
|
0 |
259 |
if( rc!=SQLITE_OK ){ |
1336
|
256 |
3 |
if( pPager->useJournal && sqliteOsFileExists(pPager->zJournal) ){ |
|
0 |
256 |
if( pPager->useJournal && sqliteOsFileExists(pPager->zJournal) ){ |
1342
|
0 |
0 |
if( rc!=SQLITE_OK ){ |
1343
|
0 |
0 |
if( sqliteOsUnlock(&pPager->fd)!=SQLITE_OK ){ |
1360
|
0 |
0 |
if( rc!=SQLITE_OK ){ |
1372
|
0 |
0 |
if( rc!=SQLITE_OK ){ |
1381
|
634 |
722 |
if( pPg==0 ){ |
1385
|
0 |
634 |
if( pPager->nPagemxPage || pPager->pFirst==0 ){ |
|
0 |
0 |
if( pPager->nPagemxPage || pPager->pFirst==0 ){ |
1389
|
0 |
634 |
if( pPg==0 ){ |
1397
|
375 |
259 |
if( pPager->pAll ){ |
1414
|
0 |
0 |
if( pPg==0 ){ |
1416
|
0 |
0 |
if( rc!=0 ){ |
1426
|
0 |
0 |
if( pPg->dirty ){ |
1430
|
0 |
0 |
if( rc!=SQLITE_OK ){ |
1445
|
0 |
0 |
if( pPg->alwaysRollback ){ |
1451
|
0 |
0 |
if( pPg==pPager->pFirstSynced ){ |
1453
|
0 |
0 |
while( p && p->needSync ){ p = p->pNextFree; } |
|
0 |
0 |
while( p && p->needSync ){ p = p->pNextFree; } |
1456
|
0 |
0 |
if( pPg->pPrevFree ){ |
1462
|
0 |
0 |
if( pPg->pNextFree ){ |
1469
|
0 |
0 |
if( pPg->pNextHash ){ |
1472
|
0 |
0 |
if( pPg->pPrevHash ){ |
1483
|
221 |
413 |
if( pPager->aInJournal && (int)pgno<=pPager->origDbSize ){ |
|
145 |
76 |
if( pPager->aInJournal && (int)pgno<=pPager->origDbSize ){ |
1492
|
0 |
634 |
if( pPager->aInCkpt && (int)pgno<=pPager->ckptSize |
|
0 |
0 |
if( pPager->aInCkpt && (int)pgno<=pPager->ckptSize |
1493
|
0 |
0 |
&& (pPager->aInCkpt[pgno/8] & (1<<(pgno&7)))!=0 ){ |
1505
|
0 |
634 |
if( pPg->pNextHash ){ |
1509
|
634 |
0 |
if( pPager->nExtra>0 ){ |
1512
|
259 |
375 |
if( pPager->dbSize<0 ) sqlitepager_pagecount(pPager); |
1513
|
0 |
634 |
if( pPager->errMask!=0 ){ |
1518
|
166 |
468 |
if( pPager->dbSize<(int)pgno ){ |
1526
|
0 |
468 |
if( rc!=SQLITE_OK ){ |
1528
|
0 |
0 |
if( sqliteOsFileSize(&pPager->fd,&fileSize)!=SQLITE_OK |
1529
|
0 |
0 |
|| fileSize>=pgno*SQLITE_PAGE_SIZE ){ |
1540
|
60 |
662 |
page_ref(pPg); |
1562
|
0 |
2 |
if( pPager->errMask & ~(PAGER_ERR_FULL) ){ |
1570
|
0 |
2 |
if( pPg==0 ) return 0; |
1571
|
0 |
2 |
page_ref(pPg); |
1596
|
691 |
676 |
if( pPg->nRef==0 ){ |
1602
|
409 |
282 |
if( pPg->pPrevFree ){ |
1607
|
493 |
198 |
if( pPg->needSync==0 && pPager->pFirstSynced==0 ){ |
|
215 |
278 |
if( pPg->needSync==0 && pPager->pFirstSynced==0 ){ |
1610
|
691 |
0 |
if( pPager->xDestructor ){ |
1619
|
256 |
435 |
if( pPager->nRef==0 ){ |
1640
|
0 |
98 |
if( pPager->aInJournal==0 ){ |
1646
|
0 |
98 |
if( rc!=SQLITE_OK ){ |
1659
|
0 |
98 |
if( pPager->errMask!=0 ){ |
1666
|
98 |
0 |
if( rc==SQLITE_OK ){ |
1667
|
23 |
75 |
rc = write32bits(&pPager->jfd, pPager->noSync ? 0xffffffff : 0); |
1669
|
98 |
0 |
if( rc==SQLITE_OK ){ |
1679
|
98 |
0 |
if( rc==SQLITE_OK ){ |
1682
|
0 |
98 |
if( pPager->ckptAutoopen && rc==SQLITE_OK ){ |
|
0 |
0 |
if( pPager->ckptAutoopen && rc==SQLITE_OK ){ |
1685
|
0 |
98 |
if( rc!=SQLITE_OK ){ |
1687
|
0 |
0 |
if( rc==SQLITE_OK ){ |
1720
|
156 |
279 |
if( pPager->state==SQLITE_READLOCK ){ |
1723
|
0 |
156 |
if( rc!=SQLITE_OK ){ |
1729
|
153 |
3 |
if( pPager->useJournal && !pPager->tempFile ){ |
|
75 |
78 |
if( pPager->useJournal && !pPager->tempFile ){ |
1760
|
0 |
426 |
if( pPager->errMask ){ |
1763
|
0 |
426 |
if( pPager->readOnly ){ |
1771
|
147 |
279 |
if( pPg->inJournal && (pPg->inCkpt || pPager->ckptInUse==0) ){ |
|
147 |
0 |
if( pPg->inJournal && (pPg->inCkpt || pPager->ckptInUse==0) ){ |
|
147 |
0 |
if( pPg->inJournal && (pPg->inCkpt || pPager->ckptInUse==0) ){ |
1785
|
0 |
279 |
if( rc!=SQLITE_OK ){ |
1789
|
55 |
224 |
if( !pPager->journalOpen && pPager->useJournal ){ |
|
23 |
32 |
if( !pPager->journalOpen && pPager->useJournal ){ |
1791
|
0 |
23 |
if( rc!=SQLITE_OK ) return rc; |
1800
|
279 |
0 |
if( !pPg->inJournal && pPager->useJournal ){ |
|
247 |
32 |
if( !pPg->inJournal && pPager->useJournal ){ |
1801
|
130 |
117 |
if( (int)pPg->pgno <= pPager->origDbSize ){ |
1820
|
0 |
130 |
if( rc!=SQLITE_OK ){ |
1830
|
0 |
130 |
if( pPager->ckptInUse ){ |
1835
|
117 |
0 |
pPg->needSync = !pPager->journalStarted && !pPager->noSync; |
|
72 |
45 |
pPg->needSync = !pPager->journalStarted && !pPager->noSync; |
1838
|
200 |
47 |
if( pPg->needSync ){ |
1848
|
0 |
279 |
if( pPager->ckptInUse && !pPg->inCkpt && (int)pPg->pgno<=pPager->ckptSize ){ |
|
0 |
0 |
if( pPager->ckptInUse && !pPg->inCkpt && (int)pPg->pgno<=pPager->ckptSize ){ |
|
0 |
0 |
if( pPager->ckptInUse && !pPg->inCkpt && (int)pPg->pgno<=pPager->ckptSize ){ |
1855
|
0 |
0 |
if( rc!=SQLITE_OK ){ |
1868
|
106 |
173 |
if( pPager->dbSize<(int)pPg->pgno ){ |
1893
|
0 |
0 |
if( rc==SQLITE_OK ){ |
1895
|
0 |
0 |
if( rc==SQLITE_OK ){ |
1932
|
40 |
0 |
if( pPg && pPg->dirty ){ |
|
8 |
32 |
if( pPg && pPg->dirty ){ |
1933
|
0 |
8 |
if( pPager->dbSize==(int)pPg->pgno && pPager->origDbSizedbSize ){ |
|
0 |
0 |
if( pPager->dbSize==(int)pPg->pgno && pPager->origDbSizedbSize ){ |
1959
|
7 |
0 |
if( pPager->state!=SQLITE_WRITELOCK || pPager->journalOpen==0 ) return; |
|
0 |
7 |
if( pPager->state!=SQLITE_WRITELOCK || pPager->journalOpen==0 ) return; |
1960
|
7 |
0 |
if( pPg->alwaysRollback || pPager->alwaysRollback ) return; |
|
0 |
7 |
if( pPg->alwaysRollback || pPager->alwaysRollback ) return; |
1961
|
7 |
0 |
if( !pPg->inJournal && (int)pPg->pgno <= pPager->origDbSize ){ |
|
7 |
0 |
if( !pPg->inJournal && (int)pPg->pgno <= pPager->origDbSize ){ |
1965
|
0 |
7 |
if( pPager->ckptInUse ){ |
1971
|
0 |
7 |
if( pPager->ckptInUse && !pPg->inCkpt && (int)pPg->pgno<=pPager->ckptSize ){ |
|
0 |
0 |
if( pPager->ckptInUse && !pPg->inCkpt && (int)pPg->pgno<=pPager->ckptSize ){ |
|
0 |
0 |
if( pPager->ckptInUse && !pPg->inCkpt && (int)pPg->pgno<=pPager->ckptSize ){ |
1990
|
0 |
143 |
if( pPager->errMask==PAGER_ERR_FULL ){ |
1992
|
0 |
0 |
if( rc==SQLITE_OK ){ |
1997
|
0 |
143 |
if( pPager->errMask!=0 ){ |
2001
|
0 |
143 |
if( pPager->state!=SQLITE_WRITELOCK ){ |
2005
|
52 |
91 |
if( pPager->dirtyFile==0 ){ |
2015
|
0 |
91 |
if( rc!=SQLITE_OK ){ |
2019
|
91 |
0 |
if( pPg ){ |
2021
|
91 |
0 |
if( rc || (!pPager->noSync && sqliteOsSync(&pPager->fd)!=SQLITE_OK) ){ |
|
68 |
23 |
if( rc || (!pPager->noSync && sqliteOsSync(&pPager->fd)!=SQLITE_OK) ){ |
|
68 |
0 |
if( rc || (!pPager->noSync && sqliteOsSync(&pPager->fd)!=SQLITE_OK) ){ |
2033
|
0 |
0 |
if( rc==SQLITE_OK ){ |
2054
|
6 |
7 |
if( !pPager->dirtyFile || !pPager->journalOpen ){ |
|
3 |
3 |
if( !pPager->dirtyFile || !pPager->journalOpen ){ |
2060
|
0 |
3 |
if( pPager->errMask!=0 && pPager->errMask!=PAGER_ERR_FULL ){ |
|
0 |
0 |
if( pPager->errMask!=0 && pPager->errMask!=PAGER_ERR_FULL ){ |
2061
|
0 |
0 |
if( pPager->state>=SQLITE_WRITELOCK ){ |
2066
|
0 |
3 |
if( pPager->state!=SQLITE_WRITELOCK ){ |
2070
|
0 |
3 |
if( rc!=SQLITE_OK ){ |
2113
|
0 |
0 |
if( !pPager->journalOpen ){ |
2120
|
0 |
0 |
if( pPager->aInCkpt==0 ){ |
2133
|
0 |
0 |
if( !pPager->ckptOpen ){ |
2135
|
0 |
0 |
if( rc ) goto ckpt_begin_failed; |
2143
|
0 |
0 |
if( pPager->aInCkpt ){ |
2154
|
0 |
156 |
if( pPager->ckptInUse ){ |
2162
|
0 |
0 |
for(pPg=pPager->pCkpt; pPg; pPg=pNext){ |
2179
|
0 |
0 |
if( pPager->ckptInUse ){ |