Add a TRACE macro to the FTS1 module for troubleshooting. Turned off by
default. (CVS 3388) FossilOrigin-Name: d4923e98c66ae03d899f633e5e309471f5695abb
This commit is contained in:
parent
189d4afaaf
commit
fb52cc95ff
@ -31,6 +31,13 @@
|
||||
#include "sqlite3ext.h"
|
||||
SQLITE_EXTENSION_INIT1
|
||||
|
||||
|
||||
#if 0
|
||||
# define TRACE(A) printf A; fflush(stdout)
|
||||
#else
|
||||
# define TRACE(A)
|
||||
#endif
|
||||
|
||||
/* utility functions */
|
||||
|
||||
/* We encode variable-length integers in little-endian order using seven bits
|
||||
@ -535,6 +542,7 @@ static char *string_format(const char *zFormat, const char *zName){
|
||||
|
||||
static int sql_exec(sqlite3 *db, const char *zName, const char *zFormat){
|
||||
char *zCommand = string_format(zFormat, zName);
|
||||
TRACE(("FTS1 sql: %s\n", zCommand));
|
||||
int rc = sqlite3_exec(db, zCommand, NULL, 0, NULL);
|
||||
free(zCommand);
|
||||
return rc;
|
||||
@ -543,6 +551,7 @@ static int sql_exec(sqlite3 *db, const char *zName, const char *zFormat){
|
||||
static int sql_prepare(sqlite3 *db, const char *zName, sqlite3_stmt **ppStmt,
|
||||
const char *zFormat){
|
||||
char *zCommand = string_format(zFormat, zName);
|
||||
TRACE(("FTS1 prepare: %s\n", zCommand));
|
||||
int rc = sqlite3_prepare(db, zCommand, -1, ppStmt, NULL);
|
||||
free(zCommand);
|
||||
return rc;
|
||||
@ -862,6 +871,7 @@ static int term_delete(fulltext_vtab *v, sqlite_int64 rowid){
|
||||
static void fulltext_vtab_destroy(fulltext_vtab *v){
|
||||
int iStmt;
|
||||
|
||||
TRACE(("FTS1 Destroy %p\n", v));
|
||||
for( iStmt=0; iStmt<MAX_STMT; iStmt++ ){
|
||||
if( v->pFulltextStatements[iStmt]!=NULL ){
|
||||
sqlite3_finalize(v->pFulltextStatements[iStmt]);
|
||||
@ -928,6 +938,7 @@ static int fulltextConnect(sqlite3 *db, void *pAux, int argc, char **argv,
|
||||
memset(v->pFulltextStatements, 0, sizeof(v->pFulltextStatements));
|
||||
|
||||
*ppVTab = &v->base;
|
||||
TRACE(("FTS1 Connect %p\n", v));
|
||||
return SQLITE_OK;
|
||||
}
|
||||
|
||||
@ -935,6 +946,7 @@ static int fulltextCreate(sqlite3 *db, void *pAux, int argc, char **argv,
|
||||
sqlite3_vtab **ppVTab){
|
||||
int rc;
|
||||
assert( argc>=3 );
|
||||
TRACE(("FTS1 Create\n"));
|
||||
|
||||
/* The %_content table holds the text of each full-text item, with
|
||||
** the rowid used as the docid.
|
||||
@ -990,10 +1002,12 @@ static int fulltextBestIndex(sqlite3_vtab *pVTab, sqlite3_index_info *pInfo){
|
||||
}
|
||||
}
|
||||
pInfo->idxNum = QUERY_GENERIC;
|
||||
TRACE(("FTS1 BestIndex\n"));
|
||||
return SQLITE_OK;
|
||||
}
|
||||
|
||||
static int fulltextDisconnect(sqlite3_vtab *pVTab){
|
||||
TRACE(("FTS1 Disconnect %p\n", pVTab));
|
||||
fulltext_vtab_destroy((fulltext_vtab *)pVTab);
|
||||
return SQLITE_OK;
|
||||
}
|
||||
@ -1001,6 +1015,7 @@ static int fulltextDisconnect(sqlite3_vtab *pVTab){
|
||||
static int fulltextDestroy(sqlite3_vtab *pVTab){
|
||||
fulltext_vtab *v = (fulltext_vtab *)pVTab;
|
||||
|
||||
TRACE(("FTS1 Destroy %p\n", pVTab));
|
||||
int rc = sql_exec(v->db, v->zName,
|
||||
"drop table %_content; drop table %_term");
|
||||
if( rc!=SQLITE_OK ) return rc;
|
||||
@ -1015,12 +1030,14 @@ static int fulltextOpen(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor){
|
||||
c = (fulltext_cursor *) calloc(sizeof(fulltext_cursor), 1);
|
||||
/* sqlite will initialize c->base */
|
||||
*ppCursor = &c->base;
|
||||
TRACE(("FTS1 Open %p: %p\n", pVTab, c));
|
||||
|
||||
return SQLITE_OK;
|
||||
}
|
||||
|
||||
static int fulltextClose(sqlite3_vtab_cursor *pCursor){
|
||||
fulltext_cursor *c = (fulltext_cursor *) pCursor;
|
||||
TRACE(("FTS1 Close %p\n", c));
|
||||
sqlite3_finalize(c->pStmt);
|
||||
if( c->result.pDoclist!=NULL ){
|
||||
docListDelete(c->result.pDoclist);
|
||||
@ -1034,6 +1051,7 @@ static int fulltextNext(sqlite3_vtab_cursor *pCursor){
|
||||
sqlite_int64 iDocid;
|
||||
int rc;
|
||||
|
||||
TRACE(("FTS1 Next %p\n", pCursor));
|
||||
switch( c->iCursorType ){
|
||||
case QUERY_GENERIC:
|
||||
/* TODO(shess) Handle SQLITE_SCHEMA AND SQLITE_BUSY. */
|
||||
@ -1268,6 +1286,7 @@ static int fulltextFilter(sqlite3_vtab_cursor *pCursor,
|
||||
int rc;
|
||||
const char *zStatement;
|
||||
|
||||
TRACE(("FTS1 Filter %p\n",pCursor));
|
||||
c->iCursorType = idxNum;
|
||||
switch( idxNum ){
|
||||
case QUERY_GENERIC:
|
||||
@ -1499,6 +1518,7 @@ static int fulltextUpdate(sqlite3_vtab *pVtab, int nArg, sqlite3_value **ppArg,
|
||||
sqlite_int64 *pRowid){
|
||||
fulltext_vtab *v = (fulltext_vtab *) pVtab;
|
||||
|
||||
TRACE(("FTS1 Update %p\n", pVtab));
|
||||
if( nArg<2 ){
|
||||
return index_delete(v, sqlite3_value_int64(ppArg[0]));
|
||||
}
|
||||
|
12
manifest
12
manifest
@ -1,5 +1,5 @@
|
||||
C Do\snot\scall\sthe\sxDisconnect\smethod\son\sa\svirtual\stable\swhile\sxUpdate\sis\npending.\s\sInstead,\sdefer\sthe\sxDisconnect\suntil\safter\sxUpdate\scompletes.\s(CVS\s3387)
|
||||
D 2006-09-02T20:57:52
|
||||
C Add\sa\sTRACE\smacro\sto\sthe\sFTS1\smodule\sfor\stroubleshooting.\s\sTurned\soff\sby\ndefault.\s(CVS\s3388)
|
||||
D 2006-09-02T20:58:26
|
||||
F Makefile.in 659b63368cfbb95a224c9d2f2a9897802d96a4ea
|
||||
F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935
|
||||
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
|
||||
@ -21,7 +21,7 @@ F ext/README.txt 913a7bd3f4837ab14d7e063304181787658b14e1
|
||||
F ext/fts1/README.txt 20ac73b006a70bcfd80069bdaf59214b6cf1db5e
|
||||
F ext/fts1/ft_hash.c 3927bd880e65329bdc6f506555b228b28924921b
|
||||
F ext/fts1/ft_hash.h 1a35e654a235c2c662d3ca0dfc3138ad60b8b7d5
|
||||
F ext/fts1/fts1.c c8532f1367150245d7d9dab4178159eeafeeece9
|
||||
F ext/fts1/fts1.c e4742aa2ed669c49120c7ccdb0730b3045ba4eb5
|
||||
F ext/fts1/fts1.h fe8e8f38dd6d2d2645b9b0d6972e80985249575f
|
||||
F ext/fts1/fts1_hash.c 3196cee866edbebb1c0521e21672e6d599965114
|
||||
F ext/fts1/fts1_hash.h 957d378355ed29f672cd5add012ce8b088a5e089
|
||||
@ -395,7 +395,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
|
||||
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
|
||||
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
|
||||
F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
|
||||
P ca864ee913ea5ae88761e617bcac300ffa339369
|
||||
R a007e2ad3282d7bf3c46df0a1cb84279
|
||||
P 61148f4c36255c4ed3552f888fa75252b300589d
|
||||
R 047544ba02c59392188ec6883b4588cb
|
||||
U drh
|
||||
Z cb0935641e94f4c2fc376bd17950fce1
|
||||
Z ad8f2586cf13efa1b155ad298401ac97
|
||||
|
@ -1 +1 @@
|
||||
61148f4c36255c4ed3552f888fa75252b300589d
|
||||
d4923e98c66ae03d899f633e5e309471f5695abb
|
Loading…
Reference in New Issue
Block a user