1Index: src/sqliteInt.h 2=================================================================== 3--- src/sqliteInt.h (revision 87306) 4+++ src/sqliteInt.h (working copy) 5@@ -2522,6 +2522,16 @@ 6 #endif 7 8 /* 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. 12+*/ 13+#if defined(__APPLE__) 14+#include <CoreServices/CoreServices.h> 15+#include <CoreFoundation/CoreFoundation.h> 16+#endif 17+ 18+/* 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. 22Index: src/pager.c 23=================================================================== 24--- src/pager.c (revision 87306) 25+++ src/pager.c (working copy) 26@@ -5130,7 +5130,21 @@ 27 } 28 } 29 30+#if defined(__APPLE__) 31 /* 32+** Create and return a CFURLRef given a cstring containing the path to a file. 33+*/ 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); 40+ return urlRef; 41+} 42+#endif 43+ 44+/* 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 @@ 49 #else 50 rc = sqlite3OsOpen(pVfs, pPager->zJournal, pPager->jfd, flags, 0); 51 #endif 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+ && strncmp(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); 65+ CFRelease(journal); 66+ } 67+ CFRelease(database); 68+ } 69+#endif 70 } 71 assert( rc!=SQLITE_OK || isOpen(pPager->jfd) ); 72 } 73Index: ext/fts3/fts3_porter.c 74=================================================================== 75--- ext/fts3/fts3_porter.c (revision 87306) 76+++ ext/fts3/fts3_porter.c (working copy) 77@@ -129,7 +129,7 @@ 78 /* 79 ** Vowel or consonant 80 */ 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, 84 1, 1, 1, 2, 1 85 }; 86@@ -153,7 +153,7 @@ 87 char x = *z; 88 if( x==0 ) return 0; 89 assert( x>='a' && x<='z' ); 90- j = cType[x-'a']; 91+ j = vOrCType[x-'a']; 92 if( j<2 ) return j; 93 return z[1]==0 || isVowel(z + 1); 94 } 95@@ -162,7 +162,7 @@ 96 char x = *z; 97 if( x==0 ) return 0; 98 assert( x>='a' && x<='z' ); 99- j = cType[x-'a']; 100+ j = vOrCType[x-'a']; 101 if( j<2 ) return 1-j; 102 return isConsonant(z + 1); 103 } 104