OLD | NEW |
1 /* fts1 has a design flaw which can lead to database corruption (see | 1 /* fts1 has a design flaw which can lead to database corruption (see |
2 ** below). It is recommended not to use it any longer, instead use | 2 ** below). It is recommended not to use it any longer, instead use |
3 ** fts3 (or higher). If you believe that your use of fts1 is safe, | 3 ** fts3 (or higher). If you believe that your use of fts1 is safe, |
4 ** add -DSQLITE_ENABLE_BROKEN_FTS1=1 to your CFLAGS. | 4 ** add -DSQLITE_ENABLE_BROKEN_FTS1=1 to your CFLAGS. |
5 */ | 5 */ |
6 #if (!defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS1)) \ | 6 #if (!defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS1)) \ |
7 && !defined(SQLITE_ENABLE_BROKEN_FTS1) | 7 && !defined(SQLITE_ENABLE_BROKEN_FTS1) |
8 #error fts1 has a design flaw and has been deprecated. | 8 #error fts1 has a design flaw and has been deprecated. |
9 #endif | 9 #endif |
10 /* The flaw is that fts1 uses the content table's unaliased rowid as | 10 /* The flaw is that fts1 uses the content table's unaliased rowid as |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 /* It is not safe to call isspace(), tolower(), or isalnum() on | 198 /* It is not safe to call isspace(), tolower(), or isalnum() on |
199 ** hi-bit-set characters. This is the same solution used in the | 199 ** hi-bit-set characters. This is the same solution used in the |
200 ** tokenizer. | 200 ** tokenizer. |
201 */ | 201 */ |
202 /* TODO(shess) The snippet-generation code should be using the | 202 /* TODO(shess) The snippet-generation code should be using the |
203 ** tokenizer-generated tokens rather than doing its own local | 203 ** tokenizer-generated tokens rather than doing its own local |
204 ** tokenization. | 204 ** tokenization. |
205 */ | 205 */ |
206 /* TODO(shess) Is __isascii() a portable version of (c&0x80)==0? */ | 206 /* TODO(shess) Is __isascii() a portable version of (c&0x80)==0? */ |
207 static int safe_isspace(char c){ | 207 static int safe_isspace(char c){ |
208 return (c&0x80)==0 ? isspace(c) : 0; | 208 return (c&0x80)==0 ? isspace((unsigned char)c) : 0; |
209 } | 209 } |
210 static int safe_tolower(char c){ | 210 static int safe_tolower(char c){ |
211 return (c&0x80)==0 ? tolower(c) : c; | 211 return (c&0x80)==0 ? tolower((unsigned char)c) : c; |
212 } | 212 } |
213 static int safe_isalnum(char c){ | 213 static int safe_isalnum(char c){ |
214 return (c&0x80)==0 ? isalnum(c) : 0; | 214 return (c&0x80)==0 ? isalnum((unsigned char)c) : 0; |
215 } | 215 } |
216 | 216 |
217 typedef enum DocListType { | 217 typedef enum DocListType { |
218 DL_DOCIDS, /* docids only */ | 218 DL_DOCIDS, /* docids only */ |
219 DL_POSITIONS, /* docids + positions */ | 219 DL_POSITIONS, /* docids + positions */ |
220 DL_POSITIONS_OFFSETS /* docids + positions + offsets */ | 220 DL_POSITIONS_OFFSETS /* docids + positions + offsets */ |
221 } DocListType; | 221 } DocListType; |
222 | 222 |
223 /* | 223 /* |
224 ** By default, only positions and not offsets are stored in the doclists. | 224 ** By default, only positions and not offsets are stored in the doclists. |
(...skipping 3114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3339 __declspec(dllexport) | 3339 __declspec(dllexport) |
3340 #endif | 3340 #endif |
3341 int sqlite3_fts1_init(sqlite3 *db, char **pzErrMsg, | 3341 int sqlite3_fts1_init(sqlite3 *db, char **pzErrMsg, |
3342 const sqlite3_api_routines *pApi){ | 3342 const sqlite3_api_routines *pApi){ |
3343 SQLITE_EXTENSION_INIT2(pApi) | 3343 SQLITE_EXTENSION_INIT2(pApi) |
3344 return sqlite3Fts1Init(db); | 3344 return sqlite3Fts1Init(db); |
3345 } | 3345 } |
3346 #endif | 3346 #endif |
3347 | 3347 |
3348 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS1) */ | 3348 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS1) */ |
OLD | NEW |