/ Check-in [c2b9891f]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix the FTS3 module with parenthesis syntax so that it will work in the amalgamation. (CVS 6087)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: c2b9891fc05ec05b270f108f61ab81b2df874e01
User & Date: drh 2008-12-31 16:01:05
Context
2008-12-31
16:27
Fix the FTS3 expression parser so that it works in the amalgamation when FTS3 is disabled. (CVS 6088) check-in: 7e238e86 user: drh tags: trunk
16:01
Fix the FTS3 module with parenthesis syntax so that it will work in the amalgamation. (CVS 6087) check-in: c2b9891f user: drh tags: trunk
2008-12-30
17:55
Fix a bug in the multi-index OR cost estimator. Remove leftover "breakpoint" commands from test scripts. (CVS 6086) check-in: b090d573 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Show Whitespace Changes Patch

Changes to ext/fts3/fts3_expr.c.

78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
...
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
...
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
** is defined to accept an argument of type int, its behaviour when passed
** an integer that falls outside of the range of the unsigned char type
** is undefined (and sometimes, "undefined" means segfault). This wrapper
** is defined to accept an argument of type char, and always returns 0 for
** any values that fall outside of the range of the unsigned char type (i.e.
** negative values).
*/
static int safe_isspace(char c){
  return (c&0x80)==0 ? isspace(c) : 0;
}

/*
** Extract the next token from buffer z (length n) using the tokenizer
** and other information (column names etc.) in pParse. Create an Fts3Expr
** structure of type FTSQUERY_PHRASE containing a phrase consisting of this
................................................................................

  const char *zInput = z;
  int nInput = n;

  /* Skip over any whitespace before checking for a keyword, an open or
  ** close bracket, or a quoted string. 
  */
  while( nInput>0 && safe_isspace(*zInput) ){
    nInput--;
    zInput++;
  }

  /* See if we are dealing with a keyword. */
  for(ii=0; ii<(int)(sizeof(aKeyword)/sizeof(struct Fts3Keyword)); ii++){
    struct Fts3Keyword *pKey = &aKeyword[ii];
................................................................................
      }

      /* At this point this is probably a keyword. But for that to be true,
      ** the next byte must contain either whitespace, an open or close
      ** bracket, a quote character, or EOF. 
      */
      cNext = zInput[nKey];
      if( safe_isspace(cNext) 
       || cNext=='"' || cNext=='(' || cNext==')' || cNext==0
      ){
        pRet = (Fts3Expr *)sqlite3_malloc(sizeof(Fts3Expr));
        memset(pRet, 0, sizeof(Fts3Expr));
        pRet->eType = pKey->eType;
        pRet->nNear = nNear;
        *ppExpr = pRet;







|







 







|







 







|







78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
...
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
...
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
** is defined to accept an argument of type int, its behaviour when passed
** an integer that falls outside of the range of the unsigned char type
** is undefined (and sometimes, "undefined" means segfault). This wrapper
** is defined to accept an argument of type char, and always returns 0 for
** any values that fall outside of the range of the unsigned char type (i.e.
** negative values).
*/
static int safe_isspace_expr(char c){
  return (c&0x80)==0 ? isspace(c) : 0;
}

/*
** Extract the next token from buffer z (length n) using the tokenizer
** and other information (column names etc.) in pParse. Create an Fts3Expr
** structure of type FTSQUERY_PHRASE containing a phrase consisting of this
................................................................................

  const char *zInput = z;
  int nInput = n;

  /* Skip over any whitespace before checking for a keyword, an open or
  ** close bracket, or a quoted string. 
  */
  while( nInput>0 && safe_isspace_expr(*zInput) ){
    nInput--;
    zInput++;
  }

  /* See if we are dealing with a keyword. */
  for(ii=0; ii<(int)(sizeof(aKeyword)/sizeof(struct Fts3Keyword)); ii++){
    struct Fts3Keyword *pKey = &aKeyword[ii];
................................................................................
      }

      /* At this point this is probably a keyword. But for that to be true,
      ** the next byte must contain either whitespace, an open or close
      ** bracket, a quote character, or EOF. 
      */
      cNext = zInput[nKey];
      if( safe_isspace_expr(cNext) 
       || cNext=='"' || cNext=='(' || cNext==')' || cNext==0
      ){
        pRet = (Fts3Expr *)sqlite3_malloc(sizeof(Fts3Expr));
        memset(pRet, 0, sizeof(Fts3Expr));
        pRet->eType = pKey->eType;
        pRet->nNear = nNear;
        *ppExpr = pRet;

Changes to tool/mksqlite3c.tcl.

85
86
87
88
89
90
91

92
93
94
95
96
97
98
...
281
282
283
284
285
286
287

288
289
290
291
292
293
294
295
296
297
298
299
300
# files are seen in a #include statement in the C code, include the complete
# text of the file in-line.  The file only needs to be included once.
#
foreach hdr {
   btree.h
   btreeInt.h
   fts3.h

   fts3_hash.h
   fts3_tokenizer.h
   hash.h
   hwtime.h
   keywordhash.h
   mutex.h
   opcodes.h
................................................................................

   tokenize.c
   complete.c

   main.c

   fts3.c

   fts3_hash.c
   fts3_porter.c
   fts3_tokenizer.c
   fts3_tokenizer1.c

   rtree.c
   icu.c
   fts3_icu.c
} {
  copy_file tsrc/$file
}

close $out







>







 







>













85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
...
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
# files are seen in a #include statement in the C code, include the complete
# text of the file in-line.  The file only needs to be included once.
#
foreach hdr {
   btree.h
   btreeInt.h
   fts3.h
   fts3_expr.h
   fts3_hash.h
   fts3_tokenizer.h
   hash.h
   hwtime.h
   keywordhash.h
   mutex.h
   opcodes.h
................................................................................

   tokenize.c
   complete.c

   main.c

   fts3.c
   fts3_expr.c
   fts3_hash.c
   fts3_porter.c
   fts3_tokenizer.c
   fts3_tokenizer1.c

   rtree.c
   icu.c
   fts3_icu.c
} {
  copy_file tsrc/$file
}

close $out