Change the fts4aux virtual table module so that fts4aux tables created in the temp database may report on fts3/fts4 tables in any attached database.
FossilOrigin-Name: 546a187f1361dad340ed8f6c28dd89e6c19f9c33
This commit is contained in:
parent
739ee7ffac
commit
a8f60381a9
@ -70,17 +70,26 @@ static int fts3auxConnectMethod(
|
||||
|
||||
UNUSED_PARAMETER(pUnused);
|
||||
|
||||
/* The user should specify a single argument - the name of an fts3 table. */
|
||||
if( argc!=4 ){
|
||||
*pzErr = sqlite3_mprintf(
|
||||
"wrong number of arguments to fts4aux constructor"
|
||||
);
|
||||
return SQLITE_ERROR;
|
||||
}
|
||||
/* The user should invoke this in one of two forms:
|
||||
**
|
||||
** CREATE VIRTUAL TABLE xxx USING fts4aux(fts4-table);
|
||||
** CREATE VIRTUAL TABLE xxx USING fts4aux(fts4-table-db, fts4-table);
|
||||
*/
|
||||
if( argc!=4 && argc!=5 ) goto bad_args;
|
||||
|
||||
zDb = argv[1];
|
||||
nDb = (int)strlen(zDb);
|
||||
if( argc==5 ){
|
||||
if( nDb==4 && 0==sqlite3_strnicmp("temp", zDb, 4) ){
|
||||
zDb = argv[3];
|
||||
nDb = (int)strlen(zDb);
|
||||
zFts3 = argv[4];
|
||||
}else{
|
||||
goto bad_args;
|
||||
}
|
||||
}else{
|
||||
zFts3 = argv[3];
|
||||
}
|
||||
nFts3 = (int)strlen(zFts3);
|
||||
|
||||
rc = sqlite3_declare_vtab(db, FTS3_TERMS_SCHEMA);
|
||||
@ -103,6 +112,10 @@ static int fts3auxConnectMethod(
|
||||
|
||||
*ppVtab = (sqlite3_vtab *)p;
|
||||
return SQLITE_OK;
|
||||
|
||||
bad_args:
|
||||
*pzErr = sqlite3_mprintf("invalid arguments to fts4aux constructor");
|
||||
return SQLITE_ERROR;
|
||||
}
|
||||
|
||||
/*
|
||||
|
16
manifest
16
manifest
@ -1,5 +1,5 @@
|
||||
C In\smptester:\simprove\sthe\sway\sthat\schild\sprocesses\sare\sdispatched.\s\sPass\nthe\s--vfs\soption\sthrough\sto\schildren.\s\sLog\sthe\scommand\sused\sto\sstart\nchild\sprocesses\swhen\sthe\stracing\slevel\sis\shigh\senough.
|
||||
D 2013-04-12T01:04:36.558
|
||||
C Change\sthe\sfts4aux\svirtual\stable\smodule\sso\sthat\sfts4aux\stables\screated\sin\sthe\stemp\sdatabase\smay\sreport\son\sfts3/fts4\stables\sin\sany\sattached\sdatabase.
|
||||
D 2013-04-12T16:47:27.407
|
||||
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
||||
F Makefile.in 3dd3fcb87b70c78d99b2c8a03e44ec86d6ca9ce2
|
||||
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
||||
@ -58,7 +58,7 @@ F ext/fts3/README.txt 8c18f41574404623b76917b9da66fcb0ab38328d
|
||||
F ext/fts3/fts3.c 0eaedfc6d2eb22563ef1d044dcfed93b70ec79f2
|
||||
F ext/fts3/fts3.h 3a10a0af180d502cecc50df77b1b22df142817fe
|
||||
F ext/fts3/fts3Int.h 1e58825246b56259267382d2f9902774c049460a
|
||||
F ext/fts3/fts3_aux.c 5205182bd8f372782597888156404766edf5781e
|
||||
F ext/fts3/fts3_aux.c b02632f6dd0e375ce97870206d914ea6d8df5ccd
|
||||
F ext/fts3/fts3_expr.c 6cb4410f87676ae633bd7923bbc78526cb839c4d
|
||||
F ext/fts3/fts3_hash.c 8dd2d06b66c72c628c2732555a32bc0943114914
|
||||
F ext/fts3/fts3_hash.h 39cf6874dc239d6b4e30479b1975fe5b22a3caaf
|
||||
@ -478,7 +478,7 @@ F test/fts3an.test a49ccadc07a2f7d646ec1b81bc09da2d85a85b18
|
||||
F test/fts3ao.test e7b80272efcced57d1d087a9da5c690dd7c21fd9
|
||||
F test/fts3atoken.test fb398ab50aa232489e2a17f9b29d7ad3a3885f36
|
||||
F test/fts3auto.test 74315a7377403a57ba82a652a33704197fe1e4be
|
||||
F test/fts3aux1.test 0b02743955d56fc0d4d66236a26177bd1b726de0
|
||||
F test/fts3aux1.test 575cc4b46320d96be10b878c954a0a08573b53b2
|
||||
F test/fts3b.test e93bbb653e52afde110ad53bbd793f14fe7a8984
|
||||
F test/fts3c.test fc723a9cf10b397fdfc2b32e73c53c8b1ec02958
|
||||
F test/fts3comp1.test a0f5b16a2df44dd0b15751787130af2183167c0c
|
||||
@ -1050,7 +1050,7 @@ F tool/vdbe-compress.tcl f12c884766bd14277f4fcedcae07078011717381
|
||||
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
|
||||
F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
|
||||
F tool/win/sqlite.vsix 97894c2790eda7b5bce3cc79cb2a8ec2fde9b3ac
|
||||
P f1b524b9d9ea3db96d54ac55c39f15e6879085bd
|
||||
R 42c876901a232f69407f221f508add46
|
||||
U drh
|
||||
Z f52bc6984c23b912a4265566462deba4
|
||||
P 55718ae3462b2b6e0774d49e1c4c74143bc9e3a5
|
||||
R dc56d874edc4dcec111c7be4534352ac
|
||||
U dan
|
||||
Z fb78d8a2b290ae6166ab0175cd5b9a72
|
||||
|
@ -1 +1 @@
|
||||
55718ae3462b2b6e0774d49e1c4c74143bc9e3a5
|
||||
546a187f1361dad340ed8f6c28dd89e6c19f9c33
|
@ -354,10 +354,10 @@ do_execsql_test 3.1.1 {
|
||||
|
||||
do_catchsql_test 3.1.2 {
|
||||
CREATE VIRTUAL TABLE terms2 USING fts4aux;
|
||||
} {1 {wrong number of arguments to fts4aux constructor}}
|
||||
} {1 {invalid arguments to fts4aux constructor}}
|
||||
do_catchsql_test 3.1.3 {
|
||||
CREATE VIRTUAL TABLE terms2 USING fts4aux(t2, t2);
|
||||
} {1 {wrong number of arguments to fts4aux constructor}}
|
||||
} {1 {invalid arguments to fts4aux constructor}}
|
||||
|
||||
do_execsql_test 3.2.1 {
|
||||
CREATE VIRTUAL TABLE terms3 USING fts4aux(does_not_exist)
|
||||
@ -444,7 +444,6 @@ do_plansql_test 4.5 {
|
||||
# odd name (one that requires quoting for use in SQL statements). And that
|
||||
# the argument to the fts4aux constructor is properly dequoted before use.
|
||||
#
|
||||
#
|
||||
do_execsql_test 5.1 {
|
||||
CREATE VIRTUAL TABLE "abc '!' def" USING fts4(x, y);
|
||||
INSERT INTO "abc '!' def" VALUES('XX', 'YY');
|
||||
@ -458,5 +457,61 @@ do_execsql_test 5.2 {
|
||||
SELECT * FROM "%%^^%%";
|
||||
} {xx * 1 1 xx 0 1 1 yy * 1 1 yy 1 1 1}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
# Test that we can create an fts4aux table in the temp database.
|
||||
#
|
||||
forcedelete test.db2
|
||||
do_execsql_test 6.1 {
|
||||
CREATE VIRTUAL TABLE ft1 USING fts4(x, y);
|
||||
INSERT INTO ft1 VALUES('a b', 'c d');
|
||||
INSERT INTO ft1 VALUES('e e', 'c d');
|
||||
INSERT INTO ft1 VALUES('a a', 'b b');
|
||||
CREATE VIRTUAL TABLE temp.aux1 USING fts4aux(main, ft1);
|
||||
SELECT * FROM aux1;
|
||||
} {
|
||||
a * 2 3 a 0 2 3
|
||||
b * 2 3 b 0 1 1 b 1 1 2
|
||||
c * 2 2 c 1 2 2
|
||||
d * 2 2 d 1 2 2
|
||||
e * 1 2 e 0 1 2
|
||||
}
|
||||
|
||||
do_execsql_test 6.2 {
|
||||
ATTACH 'test.db2' AS att;
|
||||
CREATE VIRTUAL TABLE att.ft1 USING fts4(x, y);
|
||||
INSERT INTO att.ft1 VALUES('v w', 'x y');
|
||||
INSERT INTO att.ft1 VALUES('z z', 'x y');
|
||||
INSERT INTO att.ft1 VALUES('v v', 'w w');
|
||||
CREATE VIRTUAL TABLE temp.aux2 USING fts4aux(att, ft1);
|
||||
SELECT * FROM aux2;
|
||||
} {
|
||||
v * 2 3 v 0 2 3
|
||||
w * 2 3 w 0 1 1 w 1 1 2
|
||||
x * 2 2 x 1 2 2
|
||||
y * 2 2 y 1 2 2
|
||||
z * 1 2 z 0 1 2
|
||||
}
|
||||
|
||||
foreach {tn q res1 res2} {
|
||||
1 { SELECT * FROM %%% WHERE term = 'a' } {a * 2 3 a 0 2 3} {}
|
||||
2 { SELECT * FROM %%% WHERE term = 'x' } {} {x * 2 2 x 1 2 2}
|
||||
|
||||
3 { SELECT * FROM %%% WHERE term >= 'y' }
|
||||
{} {y * 2 2 y 1 2 2 z * 1 2 z 0 1 2}
|
||||
|
||||
4 { SELECT * FROM %%% WHERE term <= 'c' }
|
||||
{a * 2 3 a 0 2 3 b * 2 3 b 0 1 1 b 1 1 2 c * 2 2 c 1 2 2} {}
|
||||
} {
|
||||
set sql1 [string map {%%% aux1} $q]
|
||||
set sql2 [string map {%%% aux2} $q]
|
||||
|
||||
do_execsql_test 7.$tn.1 $sql1 $res1
|
||||
do_execsql_test 7.$tn.2 $sql2 $res2
|
||||
}
|
||||
|
||||
do_test 8.1 {
|
||||
catchsql { CREATE VIRTUAL TABLE att.aux3 USING fts4aux(main, ft1) }
|
||||
} {1 {invalid arguments to fts4aux constructor}}
|
||||
|
||||
finish_test
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user