/ Check-in [ab76e3a9]
Login

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

Overview
Comment:The two-argument version of fts3_tokenizer() works regardless of the value of SQLITE_DBCONFIG_ENABLE_FT3_TOKENIZER as long as the second argument is a bind parameter.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | value_frombind
Files: files | file ages | folders
SHA3-256: ab76e3a90e56bd36a17ded9c7a77e88632ca12d3bd73f197df747a634c81e0cf
User & Date: drh 2019-03-29 11:39:41
Context
2019-03-29
17:26
Change the fts3_tokenizer() function to always return the pointer as a BLOB as long as the first argument is a bound parameter, regardless of the SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER setting. check-in: 27160df7 user: drh tags: value_frombind
11:39
The two-argument version of fts3_tokenizer() works regardless of the value of SQLITE_DBCONFIG_ENABLE_FT3_TOKENIZER as long as the second argument is a bind parameter. check-in: ab76e3a9 user: drh tags: value_frombind
11:13
Initial implementation of the sqlite3_value_frombind() interface. check-in: 98da62df user: drh tags: value_frombind
Changes
Hide Diffs Side-by-Side Diffs Show Whitespace Changes Patch

Changes to ext/fts3/fts3_tokenizer.c.

    75     75   
    76     76     pHash = (Fts3Hash *)sqlite3_user_data(context);
    77     77   
    78     78     zName = sqlite3_value_text(argv[0]);
    79     79     nName = sqlite3_value_bytes(argv[0])+1;
    80     80   
    81     81     if( argc==2 ){
    82         -    if( fts3TokenizerEnabled(context) ){
           82  +    if( fts3TokenizerEnabled(context) || sqlite3_value_frombind(argv[1]) ){
    83     83         void *pOld;
    84     84         int n = sqlite3_value_bytes(argv[1]);
    85     85         if( zName==0 || n!=sizeof(pPtr) ){
    86     86           sqlite3_result_error(context, "argument type mismatch", -1);
    87     87           return;
    88     88         }
    89     89         pPtr = *(void **)sqlite3_value_blob(argv[1]);

Changes to test/fts3atoken.test.

    82     82       INSERT INTO t1(content) VALUES('There was movement at the station');
    83     83       INSERT INTO t1(content) VALUES('For the word has passed around');
    84     84       INSERT INTO t1(content) VALUES('That the colt from ol regret had got');
    85     85       SELECT content FROM t1 WHERE content MATCH 'movement'
    86     86     }
    87     87   } {{There was movement at the station}}
    88     88   
           89  +unset -nocomplain simple
           90  +set simple [db one {SELECT fts3_tokenizer('simple')}]
    89     91   sqlite3_db_config db SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER 0
    90     92   do_catchsql_test 1.6 {
    91     93     SELECT fts3_tokenizer('blah', fts3_tokenizer('simple')) IS NULL;
    92     94   } {1 {fts3tokenize disabled}}
           95  +do_test fts3atoken-1.7 {
           96  +  execsql {
           97  +    SELECT fts3_tokenizer('blah2', $simple) IS NULL;
           98  +  }
           99  +} {1}
          100  +sqlite3_db_config db SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER 1
          101  +do_test fts3atoken-1.8 {
          102  +  execsql {
          103  +    SELECT fts3_tokenizer('blah2') == fts3_tokenizer('simple');
          104  +  }
          105  +} {1}
          106  +
    93    107   
    94    108   
    95    109   #--------------------------------------------------------------------------
    96    110   # Test cases fts3atoken-2.* test error cases in the scalar function based
    97    111   # API for getting and setting tokenizers.
    98    112   #
    99    113   do_test fts3atoken-2.1 {