/ Check-in [87fc0ce1]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

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

Overview
Comment:Change the fts3 test interface used to configure the advisory node size parameter.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 87fc0ce151c89beb5a43b65c0b1706f340c0c173
User & Date: dan 2009-12-11 16:03:45
Original Comment: Change the fts3 test interface used to configure the advisory node size paraemeter.
Context
2009-12-11
23:11
Additional changes to C-language interface documentation. check-in: 1342916f user: drh tags: trunk
16:03
Change the fts3 test interface used to configure the advisory node size parameter. check-in: 87fc0ce1 user: dan tags: trunk
12:29
Rationalize some code in fts3 used by optimize operations, queries of the pending-terms hash table and segment merges. Add the "INSERT INTO tbl(tbl) VALUES('optimize')" syntax. check-in: 29476da3 user: dan tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to ext/fts3/fts3.c.

   573    573     char *zCsr;
   574    574     int nDb;
   575    575     int nName;
   576    576   
   577    577     const char *zTokenizer = 0;               /* Name of tokenizer to use */
   578    578     sqlite3_tokenizer *pTokenizer = 0;        /* Tokenizer for this table */
   579    579   
   580         -#ifdef SQLITE_TEST
   581         -  const char *zTestParam = 0;
   582         -  if( strncmp(argv[argc-1], "test:", 5)==0 ){
   583         -    zTestParam = argv[argc-1];
   584         -    argc--;
   585         -  }
   586         -#endif
   587         -
   588    580     nDb = (int)strlen(argv[1]) + 1;
   589    581     nName = (int)strlen(argv[2]) + 1;
   590    582     for(i=3; i<argc; i++){
   591    583       char const *z = argv[i];
   592    584       rc = sqlite3Fts3InitTokenizer(pHash, z, &pTokenizer, &zTokenizer, pzErr);
   593    585       if( rc!=SQLITE_OK ){
   594    586         return rc;
................................................................................
   668    660       rc = fts3CreateTables(p);
   669    661       if( rc!=SQLITE_OK ) goto fts3_init_out;
   670    662     }
   671    663   
   672    664     rc = fts3DeclareVtab(p);
   673    665     if( rc!=SQLITE_OK ) goto fts3_init_out;
   674    666   
   675         -#ifdef SQLITE_TEST
   676         -  if( zTestParam ){
   677         -    p->nNodeSize = atoi(&zTestParam[5]);
   678         -  }
   679         -#endif
   680    667     *ppVTab = &p->base;
   681    668   
   682    669   fts3_init_out:
   683    670     assert( p || (pTokenizer && rc!=SQLITE_OK) );
   684    671     if( rc!=SQLITE_OK ){
   685    672       if( p ){
   686    673         fts3DisconnectMethod((sqlite3_vtab *)p);
................................................................................
  2277   2264        || (pIcu && sqlite3Fts3HashInsert(pHash, "icu", 4, (void *)pIcu))
  2278   2265   #endif
  2279   2266       ){
  2280   2267         rc = SQLITE_NOMEM;
  2281   2268       }
  2282   2269     }
  2283   2270   
  2284         -#ifdef SQLITE_TEST
  2285         -  if( rc==SQLITE_OK ){
  2286         -    rc = sqlite3Fts3ExprInitTestInterface(db);
  2287         -  }
  2288         -#endif
  2289         -
  2290   2271     /* Create the virtual table wrapper around the hash-table and overload 
  2291   2272     ** the two scalar functions. If this is successful, register the
  2292   2273     ** module with sqlite.
  2293   2274     */
  2294   2275     if( SQLITE_OK==rc 
  2295   2276      && SQLITE_OK==(rc = sqlite3Fts3InitHashTable(db, pHash, "fts3_tokenizer"))
  2296   2277      && SQLITE_OK==(rc = sqlite3_overload_function(db, "snippet", -1))

Changes to ext/fts3/fts3_write.c.

  2213   2213       return SQLITE_NOMEM;
  2214   2214     }else if( nVal==8 && 0==sqlite3_strnicmp(zVal, "optimize", 8) ){
  2215   2215       rc = fts3SegmentMerge(p, -1);
  2216   2216       if( rc==SQLITE_DONE || rc==SQLITE_OK ){
  2217   2217         rc = SQLITE_OK;
  2218   2218         sqlite3Fts3PendingTermsClear(p);
  2219   2219       }
         2220  +#ifdef SQLITE_TEST
         2221  +  }else if( nVal>9 && 0==sqlite3_strnicmp(zVal, "nodesize=", 9) ){
         2222  +    p->nNodeSize = atoi(&zVal[9]);
         2223  +    rc = SQLITE_OK;
         2224  +#endif
  2220   2225     }else{
  2221   2226       rc = SQLITE_ERROR;
  2222   2227     }
  2223   2228   
  2224   2229     return rc;
  2225   2230   }
  2226   2231   

Changes to main.mk.

   258    258     $(TOP)/src/os_os2.c $(TOP)/src/os_unix.c $(TOP)/src/os_win.c                 \
   259    259     $(TOP)/src/pager.c $(TOP)/src/pragma.c $(TOP)/src/prepare.c                  \
   260    260     $(TOP)/src/printf.c $(TOP)/src/random.c $(TOP)/src/pcache.c                  \
   261    261     $(TOP)/src/pcache1.c $(TOP)/src/select.c $(TOP)/src/tokenize.c               \
   262    262     $(TOP)/src/utf.c $(TOP)/src/util.c $(TOP)/src/vdbeapi.c $(TOP)/src/vdbeaux.c \
   263    263     $(TOP)/src/vdbe.c $(TOP)/src/vdbemem.c $(TOP)/src/where.c parse.c            \
   264    264     $(TOP)/ext/fts3/fts3.c $(TOP)/ext/fts3/fts3_expr.c                           \
   265         -  $(TOP)/ext/fts3/fts3_tokenizer.c                                             \
          265  +  $(TOP)/ext/fts3/fts3_tokenizer.c $(TOP)/ext/fts3/fts3_write.c                \
   266    266     $(TOP)/ext/async/sqlite3async.c
   267    267   
   268    268   # Header files used by all library source files.
   269    269   #
   270    270   HDR = \
   271    271      $(TOP)/src/btree.h \
   272    272      $(TOP)/src/btreeInt.h \

Changes to test/fts3rnd.test.

   210    210   foreach nodesize {50 500 1000 2000} {
   211    211     catch { array unset ::t1 }
   212    212   
   213    213     # Create the FTS3 table. Populate it (and the Tcl array) with 100 rows.
   214    214     #
   215    215     db transaction {
   216    216       catchsql { DROP TABLE t1 }
   217         -    execsql "CREATE VIRTUAL TABLE t1 USING fts3(a, b, c, test:$nodesize)"
          217  +    execsql "CREATE VIRTUAL TABLE t1 USING fts3(a, b, c)"
          218  +    execsql "INSERT INTO t1(t1) VALUES('nodesize=$nodesize')"
   218    219       for {set i 0} {$i < 100} {incr i} { insert_row $i }
   219    220     }
   220    221     
   221    222     for {set iTest 0} {$iTest <= 100} {incr iTest} {
   222    223       catchsql COMMIT
   223    224   
   224    225       set DO_MALLOC_TEST 0