| OLD | NEW |
| 1 /* | 1 /* |
| 2 ** 2001 September 15 | 2 ** 2001 September 15 |
| 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 5479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5490 pagerReleaseMapPage(pPg); | 5490 pagerReleaseMapPage(pPg); |
| 5491 }else{ | 5491 }else{ |
| 5492 sqlite3PcacheRelease(pPg); | 5492 sqlite3PcacheRelease(pPg); |
| 5493 } | 5493 } |
| 5494 pagerUnlockIfUnused(pPager); | 5494 pagerUnlockIfUnused(pPager); |
| 5495 } | 5495 } |
| 5496 void sqlite3PagerUnref(DbPage *pPg){ | 5496 void sqlite3PagerUnref(DbPage *pPg){ |
| 5497 if( pPg ) sqlite3PagerUnrefNotNull(pPg); | 5497 if( pPg ) sqlite3PagerUnrefNotNull(pPg); |
| 5498 } | 5498 } |
| 5499 | 5499 |
| 5500 #if defined(__APPLE__) | |
| 5501 /* | |
| 5502 ** Create and return a CFURLRef given a cstring containing the path to a file. | |
| 5503 */ | |
| 5504 static CFURLRef create_cfurl_from_cstring(const char* filePath){ | |
| 5505 CFStringRef urlString = CFStringCreateWithFileSystemRepresentation( | |
| 5506 kCFAllocatorDefault, filePath); | |
| 5507 CFURLRef urlRef = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, | |
| 5508 urlString, kCFURLPOSIXPathStyle, FALSE); | |
| 5509 CFRelease(urlString); | |
| 5510 return urlRef; | |
| 5511 } | |
| 5512 #endif | |
| 5513 | |
| 5514 /* | 5500 /* |
| 5515 ** This function is called at the start of every write transaction. | 5501 ** This function is called at the start of every write transaction. |
| 5516 ** There must already be a RESERVED or EXCLUSIVE lock on the database | 5502 ** There must already be a RESERVED or EXCLUSIVE lock on the database |
| 5517 ** file when this routine is called. | 5503 ** file when this routine is called. |
| 5518 ** | 5504 ** |
| 5519 ** Open the journal file for pager pPager and write a journal header | 5505 ** Open the journal file for pager pPager and write a journal header |
| 5520 ** to the start of it. If there are active savepoints, open the sub-journal | 5506 ** to the start of it. If there are active savepoints, open the sub-journal |
| 5521 ** as well. This function is only used when the journal file is being | 5507 ** as well. This function is only used when the journal file is being |
| 5522 ** opened to write a rollback log for a transaction. It is not used | 5508 ** opened to write a rollback log for a transaction. It is not used |
| 5523 ** when opening a hot journal file to roll it back. | 5509 ** when opening a hot journal file to roll it back. |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5568 ** it was originally opened. */ | 5554 ** it was originally opened. */ |
| 5569 rc = databaseIsUnmoved(pPager); | 5555 rc = databaseIsUnmoved(pPager); |
| 5570 if( rc==SQLITE_OK ){ | 5556 if( rc==SQLITE_OK ){ |
| 5571 #ifdef SQLITE_ENABLE_ATOMIC_WRITE | 5557 #ifdef SQLITE_ENABLE_ATOMIC_WRITE |
| 5572 rc = sqlite3JournalOpen( | 5558 rc = sqlite3JournalOpen( |
| 5573 pVfs, pPager->zJournal, pPager->jfd, flags, jrnlBufferSize(pPager) | 5559 pVfs, pPager->zJournal, pPager->jfd, flags, jrnlBufferSize(pPager) |
| 5574 ); | 5560 ); |
| 5575 #else | 5561 #else |
| 5576 rc = sqlite3OsOpen(pVfs, pPager->zJournal, pPager->jfd, flags, 0); | 5562 rc = sqlite3OsOpen(pVfs, pPager->zJournal, pPager->jfd, flags, 0); |
| 5577 #endif | 5563 #endif |
| 5578 #if defined(__APPLE__) | |
| 5579 /* Set the TimeMachine exclusion metadata for the journal if it has | |
| 5580 ** been set for the database. Only do this for unix-type vfs | |
| 5581 ** implementations. */ | |
| 5582 if( rc==SQLITE_OK && pPager->zFilename!=NULL | |
| 5583 && strlen(pPager->zFilename)>0 | |
| 5584 && strncmp(pVfs->zName, "unix", 4)==0 | |
| 5585 && ( pVfs->zName[4]=='-' || pVfs->zName[4]=='\0' ) ){ | |
| 5586 CFURLRef database = create_cfurl_from_cstring(pPager->zFilename); | |
| 5587 if( CSBackupIsItemExcluded(database, NULL) ){ | |
| 5588 CFURLRef journal = create_cfurl_from_cstring(pPager->zJournal); | |
| 5589 /* Ignore errors from the following exclusion call. */ | |
| 5590 CSBackupSetItemExcluded(journal, TRUE, FALSE); | |
| 5591 CFRelease(journal); | |
| 5592 } | |
| 5593 CFRelease(database); | |
| 5594 } | |
| 5595 #endif | |
| 5596 } | 5564 } |
| 5597 } | 5565 } |
| 5598 assert( rc!=SQLITE_OK || isOpen(pPager->jfd) ); | 5566 assert( rc!=SQLITE_OK || isOpen(pPager->jfd) ); |
| 5599 } | 5567 } |
| 5600 | 5568 |
| 5601 | 5569 |
| 5602 /* Write the first journal header to the journal file and open | 5570 /* Write the first journal header to the journal file and open |
| 5603 ** the sub-journal if necessary. | 5571 ** the sub-journal if necessary. |
| 5604 */ | 5572 */ |
| 5605 if( rc==SQLITE_OK ){ | 5573 if( rc==SQLITE_OK ){ |
| (...skipping 1778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7384 ** is empty, return 0. | 7352 ** is empty, return 0. |
| 7385 */ | 7353 */ |
| 7386 int sqlite3PagerWalFramesize(Pager *pPager){ | 7354 int sqlite3PagerWalFramesize(Pager *pPager){ |
| 7387 assert( pPager->eState>=PAGER_READER ); | 7355 assert( pPager->eState>=PAGER_READER ); |
| 7388 return sqlite3WalFramesize(pPager->pWal); | 7356 return sqlite3WalFramesize(pPager->pWal); |
| 7389 } | 7357 } |
| 7390 #endif | 7358 #endif |
| 7391 | 7359 |
| 7392 | 7360 |
| 7393 #endif /* SQLITE_OMIT_DISKIO */ | 7361 #endif /* SQLITE_OMIT_DISKIO */ |
| OLD | NEW |