/ 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 Side-by-Side Diffs Ignore Whitespace Patch

Changes to ext/fts3/fts3_expr.c.

    78     78   ** is defined to accept an argument of type int, its behaviour when passed
    79     79   ** an integer that falls outside of the range of the unsigned char type
    80     80   ** is undefined (and sometimes, "undefined" means segfault). This wrapper
    81     81   ** is defined to accept an argument of type char, and always returns 0 for
    82     82   ** any values that fall outside of the range of the unsigned char type (i.e.
    83     83   ** negative values).
    84     84   */
    85         -static int safe_isspace(char c){
           85  +static int safe_isspace_expr(char c){
    86     86     return (c&0x80)==0 ? isspace(c) : 0;
    87     87   }
    88     88   
    89     89   /*
    90     90   ** Extract the next token from buffer z (length n) using the tokenizer
    91     91   ** and other information (column names etc.) in pParse. Create an Fts3Expr
    92     92   ** structure of type FTSQUERY_PHRASE containing a phrase consisting of this
................................................................................
   298    298   
   299    299     const char *zInput = z;
   300    300     int nInput = n;
   301    301   
   302    302     /* Skip over any whitespace before checking for a keyword, an open or
   303    303     ** close bracket, or a quoted string. 
   304    304     */
   305         -  while( nInput>0 && safe_isspace(*zInput) ){
          305  +  while( nInput>0 && safe_isspace_expr(*zInput) ){
   306    306       nInput--;
   307    307       zInput++;
   308    308     }
   309    309   
   310    310     /* See if we are dealing with a keyword. */
   311    311     for(ii=0; ii<(int)(sizeof(aKeyword)/sizeof(struct Fts3Keyword)); ii++){
   312    312       struct Fts3Keyword *pKey = &aKeyword[ii];
................................................................................
   334    334         }
   335    335   
   336    336         /* At this point this is probably a keyword. But for that to be true,
   337    337         ** the next byte must contain either whitespace, an open or close
   338    338         ** bracket, a quote character, or EOF. 
   339    339         */
   340    340         cNext = zInput[nKey];
   341         -      if( safe_isspace(cNext) 
          341  +      if( safe_isspace_expr(cNext) 
   342    342          || cNext=='"' || cNext=='(' || cNext==')' || cNext==0
   343    343         ){
   344    344           pRet = (Fts3Expr *)sqlite3_malloc(sizeof(Fts3Expr));
   345    345           memset(pRet, 0, sizeof(Fts3Expr));
   346    346           pRet->eType = pKey->eType;
   347    347           pRet->nNear = nNear;
   348    348           *ppExpr = pRet;

Changes to tool/mksqlite3c.tcl.

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