]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Remove some dead code from fts5. Add auxiliary function api tests to the same.
authordan <dan@noemail.net>
Thu, 28 May 2015 14:37:26 +0000 (14:37 +0000)
committerdan <dan@noemail.net>
Thu, 28 May 2015 14:37:26 +0000 (14:37 +0000)
FossilOrigin-Name: 0f9df202cc58097afddb8dad662b7c7fdc2c7d0c

ext/fts5/fts5_index.c
ext/fts5/test/fts5aux.test
ext/fts5/test/fts5fault5.test
manifest
manifest.uuid

index 4b32b8e5c9df103ec9129f7b57efea0d041c8685..2e9451622752dcbf258f16516a9992313603c5d2 100644 (file)
 #define FTS5_SEGMENT_ROWID(segid, height, pgno) fts5_dri(segid, 0, height, pgno)
 #define FTS5_DLIDX_ROWID(segid, height, pgno)   fts5_dri(segid, 1, height, pgno)
 
-#if 0
-/*
-** The height of segment b-trees is actually limited to one less than 
-** (1<<HEIGHT_BITS). This is because the rowid address space for nodes
-** with such a height is used by doclist indexes.
-*/
-#define FTS5_SEGMENT_MAX_HEIGHT ((1 << FTS5_DATA_HEIGHT_B)-1)
-#endif
-
 /*
 ** Maximum segments permitted in a single index 
 */
 #define FTS5_MAX_SEGMENT 2000
 
-#if 0
-/*
-** The rowid for the doclist index associated with leaf page pgno of segment
-** segid in index idx.
-*/
-#define FTS5_DOCLIST_IDX_ROWID(segid, height, pgno) \
-        FTS5_SEGMENT_ROWID(segid, FTS5_SEGMENT_MAX_HEIGHT, pgno)
-#endif
-
 #ifdef SQLITE_DEBUG
 int sqlite3Fts5Corrupt() { return SQLITE_CORRUPT_VTAB; }
 #endif
@@ -772,46 +754,6 @@ static void fts5CloseReader(Fts5Index *p){
   }
 }
 
-/*
-** Check if row iRowid exists in the %_data table, and that it contains
-** a blob value. If so, return SQLITE_ERROR (yes - SQLITE_ERROR, not 
-** SQLITE_OK). If not, return SQLITE_CORRUPT_VTAB.
-**
-** If an error occurs (e.g. OOM or IOERR), return the relevant error code.
-**
-** This function does not need to be efficient. It is part of vary rarely
-** invoked error handling code only.
-*/
-#if 0
-static int fts5CheckMissingRowid(Fts5Index *p, i64 iRowid){
-  const char *zFmt = "SELECT typeof(block)=='blob' FROM '%q'.%Q WHERE id=%lld";
-  int bOk = 0;
-  int rc;
-  char *zSql;
-
-  zSql = sqlite3_mprintf(zFmt, p->pConfig->zDb, p->zDataTbl, iRowid);
-  if( zSql==0 ){
-    rc = SQLITE_NOMEM;
-  }else{
-    sqlite3_stmt *pStmt;
-    rc = sqlite3_prepare_v2(p->pConfig->db, zSql, -1, &pStmt, 0);
-    if( rc==SQLITE_OK ){
-      if( SQLITE_ROW==sqlite3_step(pStmt) ){
-        bOk = sqlite3_column_int(pStmt, 0);
-      }
-      rc = sqlite3_finalize(pStmt);
-    }
-    sqlite3_free(zSql);
-  }
-
-  if( rc==SQLITE_OK ){
-    rc = bOk ? SQLITE_ERROR : FTS5_CORRUPT;
-  }
-
-  return rc;
-}
-#endif
-
 static Fts5Data *fts5DataReadOrBuffer(
   Fts5Index *p, 
   Fts5Buffer *pBuf, 
@@ -978,20 +920,6 @@ static void fts5DataDelete(Fts5Index *p, i64 iFirst, i64 iLast){
   p->rc = sqlite3_reset(p->pDeleter);
 }
 
-/*
-** Close the sqlite3_blob handle used to read records from the %_data table.
-** And discard any cached reads. This function is called at the end of
-** a read transaction or when any sub-transaction is rolled back.
-*/
-#if 0
-static void fts5DataReset(Fts5Index *p){
-  if( p->pReader ){
-    sqlite3_blob_close(p->pReader);
-    p->pReader = 0;
-  }
-}
-#endif
-
 /*
 ** Remove all records associated with segment iSegid.
 */
@@ -3309,22 +3237,6 @@ static void fts5WriteAppendRowid(
   }
 }
 
-#if 0
-static void fts5WriteAppendPoslistInt(
-  Fts5Index *p, 
-  Fts5SegWriter *pWriter,
-  int iVal
-){
-  if( p->rc==SQLITE_OK ){
-    Fts5PageWriter *pPage = &pWriter->aWriter[0];
-    fts5BufferAppendVarint(&p->rc, &pPage->buf, iVal);
-    if( pPage->buf.n>=p->pConfig->pgsz ){
-      fts5WriteFlushLeaf(p, pWriter);
-    }
-  }
-}
-#endif
-
 static void fts5WriteAppendPoslistData(
   Fts5Index *p, 
   Fts5SegWriter *pWriter, 
@@ -3574,11 +3486,6 @@ static void fts5IndexMergeLevel(
   }
   bOldest = (pLvlOut->nSeg==1 && pStruct->nLevel==iLvl+2);
 
-#if 0
-fprintf(stdout, "merging %d segments from level %d!", nInput, iLvl);
-fflush(stdout);
-#endif
-
   assert( iLvl>=0 );
   for(fts5MultiIterNew(p, pStruct, 0, 0, 0, 0, iLvl, nInput, &pIter);
       fts5MultiIterEof(p, pIter)==0;
index 923724147415660eae0abb7759a354b1b0bc9beb..bbb6cf81f1ef2e8177c7f9c93b180d4a3fc0fb6e 100644 (file)
@@ -220,5 +220,25 @@ do_execsql_test 7.2 {
   FROM t1 WHERE t1 MATCH 'a OR b+c'
 } {0 1 2 0}
 
+#-------------------------------------------------------------------------
+#
+do_execsql_test 8.0 {
+  CREATE VIRTUAL TABLE x1 USING fts5(a);
+}
+
+foreach {tn lRow res} {
+  4  {"a a a" "b" "a d"} {"[a] [a] [a]" "[a] d"}
+  1  {"b d" "a b"}       {"[b] [d]" "[a] b"}
+  2  {"d b" "a d"}       {"[d] [b]" "[a] d"}
+  3  {"a a d"}           {"[a] [a] d"}
+} {
+  execsql { DELETE FROM x1 }
+  foreach row $lRow { execsql { INSERT INTO x1 VALUES($row) } }
+  breakpoint
+  do_execsql_test 8.$tn {
+    SELECT highlight(x1, 0, '[', ']') FROM x1 WHERE x1 MATCH 'a OR (b AND d)';
+  } $res
+}
+
 finish_test
 
index 21a4e5d6b49f662ca14456eb08dce739cbbd3b15..c14f394eb61cc828e63cc6f665d640e2c63e12cd 100644 (file)
@@ -76,13 +76,13 @@ do_test 3.0 {
     BEGIN;
   }
   for {set i 0} {$i < 20} {incr i} {
-    set str [string repeat "$i " 20]
+    set str [string repeat "$i " 50]
     execsql { INSERT INTO tt VALUES($str) }
   }
   execsql COMMIT
 } {}
 
-do_faultsim_test 2.1 -faults oom-t* -body {
+do_faultsim_test 3.1 -faults oom-t* -body {
   db eval {
     SELECT term FROM tv;
   }
index eb1730fed341b26957b51e2a0c16f0f8dcc53a58..328ed4e922ee13ce39a5f9dc8f006fddc3959403 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Simplifications\sand\sminor\soptimizations\sto\sfts5\sprefix\squeries\sthat\scannot\suse\sa\sprefix\sindex.
-D 2015-05-26T18:22:01.843
+C Remove\ssome\sdead\scode\sfrom\sfts5.\sAdd\sauxiliary\sfunction\sapi\stests\sto\sthe\ssame.
+D 2015-05-28T14:37:26.732
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in 2c28e557780395095c307a6e5cb539419027eb5e
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -113,7 +113,7 @@ F ext/fts5/fts5_buffer.c 861599a0abe2383f0cd0352c57001140a26b0930
 F ext/fts5/fts5_config.c 11f969ed711a0a8b611d47431d74c372ad78c713
 F ext/fts5/fts5_expr.c a8b31d363c02108dae01e13948661859f449ebb9
 F ext/fts5/fts5_hash.c 54dd25348a46ea62ea96322c572e08cd1fb37304
-F ext/fts5/fts5_index.c c41e4f90876ad7d1feeaddb14d29d4e4c7dd17db
+F ext/fts5/fts5_index.c a693ba741b82539da5779329214e5d2609e82e5f
 F ext/fts5/fts5_storage.c 5d2b51adb304643d8f825ba89283d628418b20c2
 F ext/fts5/fts5_tcl.c 7ea165878e4ae3598e89acd470a0ee1b5a00e33c
 F ext/fts5/fts5_tokenize.c 24649425adfea2c4877d8f69f2754b70374940ec
@@ -134,7 +134,7 @@ F ext/fts5/test/fts5ai.test f20e53bbf0c55bc596f1fd47f2740dae028b8f37
 F ext/fts5/test/fts5aj.test 05b569f5c16ea3098fb1984eec5cf50dbdaae5d8
 F ext/fts5/test/fts5ak.test 7b8c5df96df599293f920b7e5521ebc79f647592
 F ext/fts5/test/fts5al.test fc60ebeac9d8e366e71309d4c31fa72199d711d7
-F ext/fts5/test/fts5aux.test db9035ef292f3ae57ac392f974b1e6b1dd48c6c7
+F ext/fts5/test/fts5aux.test e5631607bbc05ac1c38cf7d691000509aca71ef3
 F ext/fts5/test/fts5auxdata.test c69b86092bf1a157172de5f9169731af3403179b
 F ext/fts5/test/fts5bigpl.test b1cfd00561350ab04994ba7dd9d48468e5e0ec3b
 F ext/fts5/test/fts5config.test c9cc535f3b36cde1e5a32bf579f3f5962a9e82b2
@@ -150,7 +150,7 @@ F ext/fts5/test/fts5fault1.test b42d3296be8a75f557cf2cbce0d8b483fc9db45b
 F ext/fts5/test/fts5fault2.test 28c36c843bb39ae855ba79827417ecc37f114341
 F ext/fts5/test/fts5fault3.test d6e9577d4312e331a913c72931bf131704efc8f3
 F ext/fts5/test/fts5fault4.test e7170486d71de72fe88018b5b920c0a9f6c19801
-F ext/fts5/test/fts5fault5.test 98e7e77bc1d8bb47c955e7d6dc870ab5736536e3
+F ext/fts5/test/fts5fault5.test 54da9fd4c3434a1d4f6abdcb6469299d91cf5875
 F ext/fts5/test/fts5fault6.test 234dc6355f8d3f8b5be2763f30699d770247c215
 F ext/fts5/test/fts5full.test 0924bdca5416a242103239ace79c6f5aa34bab8d
 F ext/fts5/test/fts5hash.test bdba7b591d503005d5a81871ba00a359daa1e969
@@ -1331,7 +1331,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32
 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P 02069782f8b7896a582582c79185b50418622736
-R 01e4b9608560855e31f532d223b68ea6
+P aef89d9f6aa536efee347367558cf5d4ea81b238
+R bb8e2d4390fd848d148991824b1dfd3a
 U dan
-Z 2a2ddee3129d7371ffa2412643605052
+Z cb932577f097e506aa4f837dda1f2a1b
index 0edfe481c82d484b956dd90016f3340b4b747026..d0242f4b60e0620c386f8d44a84e1848c3594b84 100644 (file)
@@ -1 +1 @@
-aef89d9f6aa536efee347367558cf5d4ea81b238
\ No newline at end of file
+0f9df202cc58097afddb8dad662b7c7fdc2c7d0c
\ No newline at end of file