Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(922)

Side by Side Diff: third_party/sqlite/src/src/test_journal.c

Issue 1610963002: Import SQLite 3.10.2. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/sqlite/src/src/test_intarray.c ('k') | third_party/sqlite/src/src/test_loadext.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 ** 2008 Jan 22 2 ** 2008 Jan 22
3 ** 3 **
4 ** The author disclaims copyright to this source code. In place of 4 ** The author disclaims copyright to this source code. In place of
5 ** a legal notice, here is a blessing: 5 ** a legal notice, here is a blessing:
6 ** 6 **
7 ** May you do good and not evil. 7 ** May you do good and not evil.
8 ** May you find forgiveness for yourself and forgive others. 8 ** May you find forgiveness for yourself and forgive others.
9 ** May you share freely, never taking more than you give. 9 ** May you share freely, never taking more than you give.
10 ** 10 **
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 } 402 }
403 403
404 /* Calculate and store a checksum for each page in the database file. */ 404 /* Calculate and store a checksum for each page in the database file. */
405 if( rc==SQLITE_OK ){ 405 if( rc==SQLITE_OK ){
406 int ii; 406 int ii;
407 for(ii=0; rc==SQLITE_OK && ii<(int)pMain->nPage; ii++){ 407 for(ii=0; rc==SQLITE_OK && ii<(int)pMain->nPage; ii++){
408 i64 iOff = (i64)(pMain->nPagesize) * (i64)ii; 408 i64 iOff = (i64)(pMain->nPagesize) * (i64)ii;
409 if( iOff==PENDING_BYTE ) continue; 409 if( iOff==PENDING_BYTE ) continue;
410 rc = sqlite3OsRead(pMain->pReal, aData, pMain->nPagesize, iOff); 410 rc = sqlite3OsRead(pMain->pReal, aData, pMain->nPagesize, iOff);
411 pMain->aCksum[ii] = genCksum(aData, pMain->nPagesize); 411 pMain->aCksum[ii] = genCksum(aData, pMain->nPagesize);
412 if( ii+1==pMain->nPage && rc==SQLITE_IOERR_SHORT_READ ) rc = SQLITE_OK; 412 if( ii+1==(int)pMain->nPage && rc==SQLITE_IOERR_SHORT_READ ){
413 rc = SQLITE_OK;
414 }
413 } 415 }
414 } 416 }
415 417
416 start_ioerr_simulation(iSave, iSave2); 418 start_ioerr_simulation(iSave, iSave2);
417 } 419 }
418 420
419 sqlite3_free(aData); 421 sqlite3_free(aData);
420 return rc; 422 return rc;
421 } 423 }
422 424
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 && iOfst>=(PENDING_BYTE+512) 545 && iOfst>=(PENDING_BYTE+512)
544 && iOfst+iAmt<=PENDING_BYTE+p->nPagesize 546 && iOfst+iAmt<=PENDING_BYTE+p->nPagesize
545 ){ 547 ){
546 /* No-op. This special case is hit when the backup code is copying a 548 /* No-op. This special case is hit when the backup code is copying a
547 ** to a database with a larger page-size than the source database and 549 ** to a database with a larger page-size than the source database and
548 ** it needs to fill in the non-locking-region part of the original 550 ** it needs to fill in the non-locking-region part of the original
549 ** pending-byte page. 551 ** pending-byte page.
550 */ 552 */
551 }else{ 553 }else{
552 u32 pgno = (u32)(iOfst/p->nPagesize + 1); 554 u32 pgno = (u32)(iOfst/p->nPagesize + 1);
553 assert( (iAmt==1||iAmt==p->nPagesize) && ((iOfst+iAmt)%p->nPagesize)==0 ); 555 assert( (iAmt==1||iAmt==(int)p->nPagesize) &&
556 ((iOfst+iAmt)%p->nPagesize)==0 );
554 assert( pgno<=p->nPage || p->nSync>0 ); 557 assert( pgno<=p->nPage || p->nSync>0 );
555 assert( pgno>p->nPage || sqlite3BitvecTest(p->pWritable, pgno) ); 558 assert( pgno>p->nPage || sqlite3BitvecTest(p->pWritable, pgno) );
556 } 559 }
557 } 560 }
558 561
559 rc = sqlite3OsWrite(p->pReal, zBuf, iAmt, iOfst); 562 rc = sqlite3OsWrite(p->pReal, zBuf, iAmt, iOfst);
560 if( (p->flags&SQLITE_OPEN_MAIN_JOURNAL) && iAmt==12 ){ 563 if( (p->flags&SQLITE_OPEN_MAIN_JOURNAL) && iAmt==12 ){
561 jt_file *pMain = locateDatabaseHandle(p->zName); 564 jt_file *pMain = locateDatabaseHandle(p->zName);
562 int rc2 = readJournalFile(p, pMain); 565 int rc2 = readJournalFile(p, pMain);
563 if( rc==SQLITE_OK ) rc = rc2; 566 if( rc==SQLITE_OK ) rc = rc2;
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
848 } 851 }
849 852
850 /* 853 /*
851 ** Uninstall the jt VFS, if it is installed. 854 ** Uninstall the jt VFS, if it is installed.
852 */ 855 */
853 void jt_unregister(void){ 856 void jt_unregister(void){
854 sqlite3_vfs_unregister(&jt_vfs); 857 sqlite3_vfs_unregister(&jt_vfs);
855 } 858 }
856 859
857 #endif 860 #endif
OLDNEW
« no previous file with comments | « third_party/sqlite/src/src/test_intarray.c ('k') | third_party/sqlite/src/src/test_loadext.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698