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

Side by Side Diff: third_party/sqlite/src/ext/fts2/fts2.c

Issue 5626002: Update sqlite to 3.7.3. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/third_party/sqlite/src
Patch Set: Remove misc change. Created 10 years 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 | Annotate | Revision Log
OLDNEW
1 /* fts2 has a design flaw which can lead to database corruption (see 1 /* fts2 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 fts2 is safe, 3 ** fts3 (or higher). If you believe that your use of fts2 is safe,
4 ** add -DSQLITE_ENABLE_BROKEN_FTS2=1 to your CFLAGS. 4 ** add -DSQLITE_ENABLE_BROKEN_FTS2=1 to your CFLAGS.
5 */ 5 */
6 #if (!defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS2)) \ 6 #if (!defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS2)) \
7 && !defined(SQLITE_ENABLE_BROKEN_FTS2) 7 && !defined(SQLITE_ENABLE_BROKEN_FTS2)
8 #error fts2 has a design flaw and has been deprecated. 8 #error fts2 has a design flaw and has been deprecated.
9 #endif 9 #endif
10 /* The flaw is that fts2 uses the content table's unaliased rowid as 10 /* The flaw is that fts2 uses the content table's unaliased rowid as
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 #if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS2) 313 #if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS2)
314 314
315 #if defined(SQLITE_ENABLE_FTS2) && !defined(SQLITE_CORE) 315 #if defined(SQLITE_ENABLE_FTS2) && !defined(SQLITE_CORE)
316 # define SQLITE_CORE 1 316 # define SQLITE_CORE 1
317 #endif 317 #endif
318 318
319 #include <assert.h> 319 #include <assert.h>
320 #include <stdlib.h> 320 #include <stdlib.h>
321 #include <stdio.h> 321 #include <stdio.h>
322 #include <string.h> 322 #include <string.h>
323 #include <ctype.h>
324
325 #include "fts2.h" 323 #include "fts2.h"
326 #include "fts2_hash.h" 324 #include "fts2_hash.h"
327 #include "fts2_tokenizer.h" 325 #include "fts2_tokenizer.h"
328 #include "sqlite3.h" 326 #include "sqlite3.h"
329 #include "sqlite3ext.h" 327 #include "sqlite3ext.h"
330 SQLITE_EXTENSION_INIT1 328 SQLITE_EXTENSION_INIT1
331 329
332 330
333 /* TODO(shess) MAN, this thing needs some refactoring. At minimum, it 331 /* TODO(shess) MAN, this thing needs some refactoring. At minimum, it
334 ** would be nice to order the file better, perhaps something along the 332 ** would be nice to order the file better, perhaps something along the
(...skipping 27 matching lines...) Expand all
362 /* It is not safe to call isspace(), tolower(), or isalnum() on 360 /* It is not safe to call isspace(), tolower(), or isalnum() on
363 ** hi-bit-set characters. This is the same solution used in the 361 ** hi-bit-set characters. This is the same solution used in the
364 ** tokenizer. 362 ** tokenizer.
365 */ 363 */
366 /* TODO(shess) The snippet-generation code should be using the 364 /* TODO(shess) The snippet-generation code should be using the
367 ** tokenizer-generated tokens rather than doing its own local 365 ** tokenizer-generated tokens rather than doing its own local
368 ** tokenization. 366 ** tokenization.
369 */ 367 */
370 /* TODO(shess) Is __isascii() a portable version of (c&0x80)==0? */ 368 /* TODO(shess) Is __isascii() a portable version of (c&0x80)==0? */
371 static int safe_isspace(char c){ 369 static int safe_isspace(char c){
372 return (c&0x80)==0 ? isspace(c) : 0; 370 return c==' ' || c=='\t' || c=='\n' || c=='\r' || c=='\v' || c=='\f';
373 } 371 }
374 static int safe_tolower(char c){ 372 static int safe_tolower(char c){
375 return (c>='A' && c<='Z') ? (c-'A'+'a') : c; 373 return (c>='A' && c<='Z') ? (c - 'A' + 'a') : c;
376 } 374 }
377 static int safe_isalnum(char c){ 375 static int safe_isalnum(char c){
378 return (c&0x80)==0 ? isalnum(c) : 0; 376 return (c>='0' && c<='9') || (c>='A' && c<='Z') || (c>='a' && c<='z');
379 } 377 }
380 378
381 typedef enum DocListType { 379 typedef enum DocListType {
382 DL_DOCIDS, /* docids only */ 380 DL_DOCIDS, /* docids only */
383 DL_POSITIONS, /* docids + positions */ 381 DL_POSITIONS, /* docids + positions */
384 DL_POSITIONS_OFFSETS /* docids + positions + offsets */ 382 DL_POSITIONS_OFFSETS /* docids + positions + offsets */
385 } DocListType; 383 } DocListType;
386 384
387 /* 385 /*
388 ** By default, only positions and not offsets are stored in the doclists. 386 ** By default, only positions and not offsets are stored in the doclists.
(...skipping 6891 matching lines...) Expand 10 before | Expand all | Expand 10 after
7280 sqlite3 *db, 7278 sqlite3 *db,
7281 char **pzErrMsg, 7279 char **pzErrMsg,
7282 const sqlite3_api_routines *pApi 7280 const sqlite3_api_routines *pApi
7283 ){ 7281 ){
7284 SQLITE_EXTENSION_INIT2(pApi) 7282 SQLITE_EXTENSION_INIT2(pApi)
7285 return sqlite3Fts2Init(db); 7283 return sqlite3Fts2Init(db);
7286 } 7284 }
7287 #endif 7285 #endif
7288 7286
7289 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS2) */ 7287 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS2) */
OLDNEW
« no previous file with comments | « third_party/sqlite/src/ext/fts2/README.tokenizers ('k') | third_party/sqlite/src/ext/fts2/fts2_porter.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698