2 ===================================================================
3 --- src/sqliteInt.h (revision 87306)
4 +++ src/sqliteInt.h (working copy)
9 +** The CoreServices.h and CoreFoundation.h headers are needed for excluding a
10 +** -journal file from Time Machine backups when its associated database has
11 +** previously been excluded by the client code.
13 +#if defined(__APPLE__)
14 +#include <CoreServices/CoreServices.h>
15 +#include <CoreFoundation/CoreFoundation.h>
19 ** The following macros mimic the standard library functions toupper(),
20 ** isspace(), isalnum(), isdigit() and isxdigit(), respectively. The
21 ** sqlite versions only work for ASCII characters, regardless of locale.
23 ===================================================================
24 --- src/pager.c (revision 87306)
25 +++ src/pager.c (working copy)
26 @@ -5130,7 +5130,21 @@
30 +#if defined(__APPLE__)
32 +** Create and return a CFURLRef given a cstring containing the path to a file.
34 +static CFURLRef create_cfurl_from_cstring(const char* filePath){
35 + CFStringRef urlString = CFStringCreateWithFileSystemRepresentation(
36 + kCFAllocatorDefault, filePath);
37 + CFURLRef urlRef = CFURLCreateWithFileSystemPath(kCFAllocatorDefault,
38 + urlString, kCFURLPOSIXPathStyle, FALSE);
39 + CFRelease(urlString);
45 ** This function is called at the start of every write transaction.
46 ** There must already be a RESERVED or EXCLUSIVE lock on the database
47 ** file when this routine is called.
48 @@ -5189,6 +5203,24 @@
50 rc = sqlite3OsOpen(pVfs, pPager->zJournal, pPager->jfd, flags, 0);
52 +#if defined(__APPLE__)
53 + /* Set the TimeMachine exclusion metadata for the journal if it has
54 + ** been set for the database. Only do this for unix-type vfs
55 + ** implementations. */
56 + if( rc==SQLITE_OK && pPager->zFilename!=NULL
57 + && strlen(pPager->zFilename)>0
58 + && memcmp(pVfs->zName, "unix", 4)==0
59 + && ( pVfs->zName[4]=='-' || pVfs->zName[4]=='\0' ) ){
60 + CFURLRef database = create_cfurl_from_cstring(pPager->zFilename);
61 + if( CSBackupIsItemExcluded(database, NULL) ){
62 + CFURLRef journal = create_cfurl_from_cstring(pPager->zJournal);
63 + /* Ignore errors from the following exclusion call. */
64 + CSBackupSetItemExcluded(journal, TRUE, FALSE);
67 + CFRelease(database);
71 assert( rc!=SQLITE_OK || isOpen(pPager->jfd) );
73 Index: ext/fts3/fts3_porter.c
74 ===================================================================
75 --- ext/fts3/fts3_porter.c (revision 87306)
76 +++ ext/fts3/fts3_porter.c (working copy)
81 -static const char cType[] = {
82 +static const char vOrCType[] = {
83 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0,
89 assert( x>='a' && x<='z' );
91 + j = vOrCType[x-'a'];
93 return z[1]==0 || isVowel(z + 1);
98 assert( x>='a' && x<='z' );
100 + j = vOrCType[x-'a'];
101 if( j<2 ) return 1-j;
102 return isConsonant(z + 1);