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

Side by Side Diff: third_party/sqlite/patches/0003-Exclude-journal-file-from-Time-Machine-if-database-i.patch

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
OLDNEW
1 From edfff157e1d9292bfcce6553b76ee913b53b1aa1 Mon Sep 17 00:00:00 2001 1 From bacae540479e7dc84bfbd059a20afa2ef00e8cdb Mon Sep 17 00:00:00 2001
2 From: mrossetti <mrossetti@chromium.org> 2 From: mrossetti <mrossetti@chromium.org>
3 Date: Tue, 31 May 2011 23:12:11 +0000 3 Date: Tue, 31 May 2011 23:12:11 +0000
4 Subject: [PATCH 04/16] Exclude journal file from Time Machine if database is 4 Subject: [PATCH 03/10] Exclude journal file from Time Machine if database is
5 excluded. 5 excluded.
6 6
7 BUG=74053 7 BUG=74053
8 8
9 Original review URL: http://codereview.chromium.org/6990066 9 Original review URL: http://codereview.chromium.org/6990066
10 10
11 TODO(shess): The fts3_porter.c change is due to a conflict with an included 11 TODO(shess): The fts3_porter.c change is due to a conflict with an included
12 Apple library. Perhaps move the operative code to a .c file, and firewall 12 Apple library. Perhaps move the operative code to a .c file, and firewall
13 SQLite from that include. 13 SQLite from that include.
14 14
15 TODO(shess): Revisit this for -wal mode. http://crbug.com/78507 15 TODO(shess): Revisit this for -wal mode. http://crbug.com/78507
16 --- 16 ---
17 third_party/sqlite/src/Makefile.linux-gcc | 4 ++++ 17 third_party/sqlite/src/Makefile.linux-gcc | 4 ++++
18 third_party/sqlite/src/ext/fts3/fts3_porter.c | 6 ++--- 18 third_party/sqlite/src/ext/fts3/fts3_porter.c | 6 ++---
19 third_party/sqlite/src/main.mk | 2 +- 19 third_party/sqlite/src/main.mk | 2 +-
20 third_party/sqlite/src/src/pager.c | 32 +++++++++++++++++++++++++++ 20 third_party/sqlite/src/src/pager.c | 32 +++++++++++++++++++++++++++
21 third_party/sqlite/src/src/sqliteInt.h | 10 +++++++++ 21 third_party/sqlite/src/src/sqliteInt.h | 10 +++++++++
22 5 files changed, 50 insertions(+), 4 deletions(-) 22 5 files changed, 50 insertions(+), 4 deletions(-)
23 23
24 diff --git a/third_party/sqlite/src/Makefile.linux-gcc b/third_party/sqlite/src/ Makefile.linux-gcc 24 diff --git a/third_party/sqlite/src/Makefile.linux-gcc b/third_party/sqlite/src/ Makefile.linux-gcc
25 index 6d67ba7..554bf56 100644 25 index a1dec21..952e8d1 100644
26 --- a/third_party/sqlite/src/Makefile.linux-gcc 26 --- a/third_party/sqlite/src/Makefile.linux-gcc
27 +++ b/third_party/sqlite/src/Makefile.linux-gcc 27 +++ b/third_party/sqlite/src/Makefile.linux-gcc
28 @@ -44,7 +44,11 @@ THREADLIB = -lpthread 28 @@ -44,7 +44,11 @@ THREADLIB = -lpthread
29 #### Specify any extra libraries needed to access required functions. 29 #### Specify any extra libraries needed to access required functions.
30 # 30 #
31 #TLIBS = -lrt # fdatasync on Solaris 8 31 #TLIBS = -lrt # fdatasync on Solaris 8
32 +ifeq ($(shell uname -s),Darwin) 32 +ifeq ($(shell uname -s),Darwin)
33 +TLIBS = -framework CoreServices 33 +TLIBS = -framework CoreServices
34 +else 34 +else
35 TLIBS = -ldl 35 TLIBS = -ldl
36 +endif 36 +endif
37 37
38 #### Leave SQLITE_DEBUG undefined for maximum speed. Use SQLITE_DEBUG=1 38 #### Leave SQLITE_DEBUG undefined for maximum speed. Use SQLITE_DEBUG=1
39 # to check for memory leaks. Use SQLITE_DEBUG=2 to print a log of all 39 # to check for memory leaks. Use SQLITE_DEBUG=2 to print a log of all
40 diff --git a/third_party/sqlite/src/ext/fts3/fts3_porter.c b/third_party/sqlite/ src/ext/fts3/fts3_porter.c 40 diff --git a/third_party/sqlite/src/ext/fts3/fts3_porter.c b/third_party/sqlite/ src/ext/fts3/fts3_porter.c
41 index db175ac..933602a 100644 41 index 8fb4c25d..b180ee2 100644
42 --- a/third_party/sqlite/src/ext/fts3/fts3_porter.c 42 --- a/third_party/sqlite/src/ext/fts3/fts3_porter.c
43 +++ b/third_party/sqlite/src/ext/fts3/fts3_porter.c 43 +++ b/third_party/sqlite/src/ext/fts3/fts3_porter.c
44 @@ -128,7 +128,7 @@ static int porterClose(sqlite3_tokenizer_cursor *pCursor){ 44 @@ -128,7 +128,7 @@ static int porterClose(sqlite3_tokenizer_cursor *pCursor){
45 /* 45 /*
46 ** Vowel or consonant 46 ** Vowel or consonant
47 */ 47 */
48 -static const char cType[] = { 48 -static const char cType[] = {
49 +static const char vOrCType[] = { 49 +static const char vOrCType[] = {
50 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 50 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0,
51 1, 1, 1, 2, 1 51 1, 1, 1, 2, 1
(...skipping 10 matching lines...) Expand all
62 @@ -161,7 +161,7 @@ static int isVowel(const char *z){ 62 @@ -161,7 +161,7 @@ static int isVowel(const char *z){
63 char x = *z; 63 char x = *z;
64 if( x==0 ) return 0; 64 if( x==0 ) return 0;
65 assert( x>='a' && x<='z' ); 65 assert( x>='a' && x<='z' );
66 - j = cType[x-'a']; 66 - j = cType[x-'a'];
67 + j = vOrCType[x-'a']; 67 + j = vOrCType[x-'a'];
68 if( j<2 ) return 1-j; 68 if( j<2 ) return 1-j;
69 return isConsonant(z + 1); 69 return isConsonant(z + 1);
70 } 70 }
71 diff --git a/third_party/sqlite/src/main.mk b/third_party/sqlite/src/main.mk 71 diff --git a/third_party/sqlite/src/main.mk b/third_party/sqlite/src/main.mk
72 index 4a7ac02..dc56b0d 100644 72 index fcc0270..6ff3bd4 100644
73 --- a/third_party/sqlite/src/main.mk 73 --- a/third_party/sqlite/src/main.mk
74 +++ b/third_party/sqlite/src/main.mk 74 +++ b/third_party/sqlite/src/main.mk
75 @@ -591,7 +591,7 @@ TESTFIXTURE_FLAGS += -DSQLITE_SERVER=1 -DSQLITE_PRIVATE="" - DSQLITE_CORE 75 @@ -724,7 +724,7 @@ TESTFIXTURE_FLAGS += -DSQLITE_SERVER=1 -DSQLITE_PRIVATE="" - DSQLITE_CORE
76 testfixture$(EXE): $(TESTSRC2) libsqlite3.a $(TESTSRC) $(TOP)/src/tclsqlite.c 76 testfixture$(EXE): $(TESTSRC2) libsqlite3.a $(TESTSRC) $(TOP)/src/tclsqlite.c
77 $(TCCX) $(TCL_FLAGS) -DTCLSH=1 $(TESTFIXTURE_FLAGS) \ 77 $(TCCX) $(TCL_FLAGS) -DTCLSH=1 $(TESTFIXTURE_FLAGS) \
78 $(TESTSRC) $(TESTSRC2) $(TOP)/src/tclsqlite.c \ 78 $(TESTSRC) $(TESTSRC2) $(TOP)/src/tclsqlite.c \
79 - -o testfixture$(EXE) $(LIBTCL) libsqlite3.a $(THREADLIB) 79 - -o testfixture$(EXE) $(LIBTCL) libsqlite3.a $(THREADLIB)
80 + -o testfixture$(EXE) $(LIBTCL) libsqlite3.a $(THREADLIB) $(TLIBS ) 80 + -o testfixture$(EXE) $(LIBTCL) libsqlite3.a $(THREADLIB) $(TLIBS )
81 81
82 amalgamation-testfixture$(EXE): sqlite3.c $(TESTSRC) $(TOP)/src/tclsqlite.c 82 amalgamation-testfixture$(EXE): sqlite3.c $(TESTSRC) $(TOP)/src/tclsqlite.c
83 $(TCCX) $(TCL_FLAGS) -DTCLSH=1 $(TESTFIXTURE_FLAGS) \ 83 $(TCCX) $(TCL_FLAGS) -DTCLSH=1 $(TESTFIXTURE_FLAGS) \
84 diff --git a/third_party/sqlite/src/src/pager.c b/third_party/sqlite/src/src/pag er.c 84 diff --git a/third_party/sqlite/src/src/pager.c b/third_party/sqlite/src/src/pag er.c
85 index d840a39..34fa50f 100644 85 index 2c904d2..74c76f37 100644
86 --- a/third_party/sqlite/src/src/pager.c 86 --- a/third_party/sqlite/src/src/pager.c
87 +++ b/third_party/sqlite/src/src/pager.c 87 +++ b/third_party/sqlite/src/src/pager.c
88 @@ -5467,6 +5467,20 @@ void sqlite3PagerUnref(DbPage *pPg){ 88 @@ -5497,6 +5497,20 @@ void sqlite3PagerUnref(DbPage *pPg){
89 if( pPg ) sqlite3PagerUnrefNotNull(pPg); 89 if( pPg ) sqlite3PagerUnrefNotNull(pPg);
90 } 90 }
91 91
92 +#if defined(__APPLE__) 92 +#if defined(__APPLE__)
93 +/* 93 +/*
94 +** Create and return a CFURLRef given a cstring containing the path to a file. 94 +** Create and return a CFURLRef given a cstring containing the path to a file.
95 +*/ 95 +*/
96 +static CFURLRef create_cfurl_from_cstring(const char* filePath){ 96 +static CFURLRef create_cfurl_from_cstring(const char* filePath){
97 + CFStringRef urlString = CFStringCreateWithFileSystemRepresentation( 97 + CFStringRef urlString = CFStringCreateWithFileSystemRepresentation(
98 + kCFAllocatorDefault, filePath); 98 + kCFAllocatorDefault, filePath);
99 + CFURLRef urlRef = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, 99 + CFURLRef urlRef = CFURLCreateWithFileSystemPath(kCFAllocatorDefault,
100 + urlString, kCFURLPOSIXPathStyle, FALSE); 100 + urlString, kCFURLPOSIXPathStyle, FALSE);
101 + CFRelease(urlString); 101 + CFRelease(urlString);
102 + return urlRef; 102 + return urlRef;
103 +} 103 +}
104 +#endif 104 +#endif
105 + 105 +
106 /* 106 /*
107 ** This function is called at the start of every write transaction. 107 ** This function is called at the start of every write transaction.
108 ** There must already be a RESERVED or EXCLUSIVE lock on the database 108 ** There must already be a RESERVED or EXCLUSIVE lock on the database
109 @@ -5531,6 +5545,24 @@ static int pager_open_journal(Pager *pPager){ 109 @@ -5561,6 +5575,24 @@ static int pager_open_journal(Pager *pPager){
110 #else 110 #else
111 rc = sqlite3OsOpen(pVfs, pPager->zJournal, pPager->jfd, flags, 0); 111 rc = sqlite3OsOpen(pVfs, pPager->zJournal, pPager->jfd, flags, 0);
112 #endif 112 #endif
113 +#if defined(__APPLE__) 113 +#if defined(__APPLE__)
114 + /* Set the TimeMachine exclusion metadata for the journal if it has 114 + /* Set the TimeMachine exclusion metadata for the journal if it has
115 + ** been set for the database. Only do this for unix-type vfs 115 + ** been set for the database. Only do this for unix-type vfs
116 + ** implementations. */ 116 + ** implementations. */
117 + if( rc==SQLITE_OK && pPager->zFilename!=NULL 117 + if( rc==SQLITE_OK && pPager->zFilename!=NULL
118 + && strlen(pPager->zFilename)>0 118 + && strlen(pPager->zFilename)>0
119 + && strncmp(pVfs->zName, "unix", 4)==0 119 + && strncmp(pVfs->zName, "unix", 4)==0
120 + && ( pVfs->zName[4]=='-' || pVfs->zName[4]=='\0' ) ){ 120 + && ( pVfs->zName[4]=='-' || pVfs->zName[4]=='\0' ) ){
121 + CFURLRef database = create_cfurl_from_cstring(pPager->zFilename); 121 + CFURLRef database = create_cfurl_from_cstring(pPager->zFilename);
122 + if( CSBackupIsItemExcluded(database, NULL) ){ 122 + if( CSBackupIsItemExcluded(database, NULL) ){
123 + CFURLRef journal = create_cfurl_from_cstring(pPager->zJournal); 123 + CFURLRef journal = create_cfurl_from_cstring(pPager->zJournal);
124 + /* Ignore errors from the following exclusion call. */ 124 + /* Ignore errors from the following exclusion call. */
125 + CSBackupSetItemExcluded(journal, TRUE, FALSE); 125 + CSBackupSetItemExcluded(journal, TRUE, FALSE);
126 + CFRelease(journal); 126 + CFRelease(journal);
127 + } 127 + }
128 + CFRelease(database); 128 + CFRelease(database);
129 + } 129 + }
130 +#endif 130 +#endif
131 } 131 }
132 } 132 }
133 assert( rc!=SQLITE_OK || isOpen(pPager->jfd) ); 133 assert( rc!=SQLITE_OK || isOpen(pPager->jfd) );
134 diff --git a/third_party/sqlite/src/src/sqliteInt.h b/third_party/sqlite/src/src /sqliteInt.h 134 diff --git a/third_party/sqlite/src/src/sqliteInt.h b/third_party/sqlite/src/src /sqliteInt.h
135 index 63036c5..9d6a7d8 100644 135 index c01bbc7..745b910 100644
136 --- a/third_party/sqlite/src/src/sqliteInt.h 136 --- a/third_party/sqlite/src/src/sqliteInt.h
137 +++ b/third_party/sqlite/src/src/sqliteInt.h 137 +++ b/third_party/sqlite/src/src/sqliteInt.h
138 @@ -2985,6 +2985,16 @@ int sqlite3CantopenError(int); 138 @@ -3168,6 +3168,16 @@ int sqlite3CantopenError(int);
139 #endif 139 #endif
140 140
141 /* 141 /*
142 +** The CoreServices.h and CoreFoundation.h headers are needed for excluding a 142 +** The CoreServices.h and CoreFoundation.h headers are needed for excluding a
143 +** -journal file from Time Machine backups when its associated database has 143 +** -journal file from Time Machine backups when its associated database has
144 +** previously been excluded by the client code. 144 +** previously been excluded by the client code.
145 +*/ 145 +*/
146 +#if defined(__APPLE__) 146 +#if defined(__APPLE__)
147 +#include <CoreServices/CoreServices.h> 147 +#include <CoreServices/CoreServices.h>
148 +#include <CoreFoundation/CoreFoundation.h> 148 +#include <CoreFoundation/CoreFoundation.h>
149 +#endif 149 +#endif
150 + 150 +
151 +/* 151 +/*
152 ** The following macros mimic the standard library functions toupper(), 152 ** The following macros mimic the standard library functions toupper(),
153 ** isspace(), isalnum(), isdigit() and isxdigit(), respectively. The 153 ** isspace(), isalnum(), isdigit() and isxdigit(), respectively. The
154 ** sqlite versions only work for ASCII characters, regardless of locale. 154 ** sqlite versions only work for ASCII characters, regardless of locale.
155 -- 155 --
156 2.2.1 156 2.7.0
157 157
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698