Allow test_bestindex.c to set the omit flag for a constraint.

FossilOrigin-Name: 759b9d5b22aa60cc1d6b606f81eb7366c28cbcbe
This commit is contained in:
dan 2016-03-01 18:24:36 +00:00
parent 8e4251b633
commit a3a44dd379
4 changed files with 16 additions and 14 deletions

View File

@ -1,5 +1,5 @@
C Add\stest\scode\suseful\sfor\stesting\sthe\splanners\suse\sof\steh\svirtual\stable\sxBestIndex()\smethod.
D 2016-03-01T18:07:43.649
C Allow\stest_bestindex.c\sto\sset\sthe\somit\sflag\sfor\sa\sconstraint.
D 2016-03-01T18:24:36.515
F Makefile.in 4e90dc1521879022aa9479268a4cd141d1771142
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
F Makefile.msc 4f319afb7c049d40aff7af6e8c4e7cc2ba18e079
@ -371,7 +371,7 @@ F src/test9.c bea1e8cf52aa93695487badedd6e1886c321ea60
F src/test_async.c 21e11293a2f72080eda70e1124e9102044531cd8
F src/test_autoext.c dea8a01a7153b9adc97bd26161e4226329546e12
F src/test_backup.c 2e6e6a081870150f20c526a2e9d0d29cda47d803
F src/test_bestindex.c 2004eeca2d227fe62ed581776dc7fd349d45b8f3
F src/test_bestindex.c 6448b9b7ef9729f04093462be539255938d256db
F src/test_blob.c b2551a9b5573232db5f66f292307c37067937239
F src/test_btree.c 2e9978eca99a9a4bfa8cae949efb00886860a64f
F src/test_config.c 0dee90328e3dedf8ba002ee94b6a7e7ea7726fe4
@ -493,7 +493,7 @@ F test/backup_malloc.test 7162d604ec2b4683c4b3799a48657fb8b5e2d450
F test/badutf.test d5360fc31f643d37a973ab0d8b4fb85799c3169f
F test/badutf2.test f5bc7f2d280670ecd79b9cf4f0f1760c607fe51f
F test/bc_common.tcl 3eda41ef9cda7d5f6c205462c96228b301da4191
F test/bestindex1.test a7213b26f039edfcdb4c0cc13392b79cd4a23779
F test/bestindex1.test 8d8ae7e96a98079f43518cae536535cc52aee49b
F test/between.test 34d375fb5ce1ae283ffe82b6b233e9f38e84fc6c
F test/bigfile.test aa74f4e5db51c8e54a1d9de9fa65d01d1eb20b59
F test/bigfile2.test 1b489a3a39ae90c7f027b79110d6b4e1dbc71bfc
@ -1453,10 +1453,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P f2c16094a536e7ef62444d0fe38cbee2a4999426
R c8660859b43a9c62a3adc82692a6c451
T *branch * test-bestindex
T *sym-test-bestindex *
T -sym-trunk *
P de034c0db66298454ae8418949d58eb6e223c0de
R 25f59441195481b2d87b75ea969fe23e
U dan
Z 7443660e56c432a07b1f019ab23aa0dc
Z 102ea7e54c5366f48aedd548677f81f2

View File

@ -1 +1 @@
de034c0db66298454ae8418949d58eb6e223c0de
759b9d5b22aa60cc1d6b606f81eb7366c28cbcbe

View File

@ -302,6 +302,7 @@ static int tclBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo){
** "use" (index of used constraint in aConstraint[])
** "idxnum" (value of idxNum field)
** "idxstr" (value of idxStr field)
** "omit" (index of omitted constraint in aConstraint[])
*/
Tcl_Obj *pRes = Tcl_GetObjResult(interp);
Tcl_Obj **apElem = 0;
@ -332,7 +333,9 @@ static int tclBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo){
if( sqlite3_stricmp("rows", zCmd)==0 ){
rc = Tcl_GetWideIntFromObj(interp, p, &pIdxInfo->estimatedRows);
}else
if( sqlite3_stricmp("use", zCmd)==0 ){
if( sqlite3_stricmp("use", zCmd)==0
|| sqlite3_stricmp("omit", zCmd)==0
){
int iCons;
rc = Tcl_GetIntFromObj(interp, p, &iCons);
if( rc==SQLITE_OK ){
@ -340,7 +343,9 @@ static int tclBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo){
rc = SQLITE_ERROR;
pTab->base.zErrMsg = sqlite3_mprintf("unexpected: %d", iCons);
}else{
int bOmit = (zCmd[0]=='o' || zCmd[0]=='O');
pIdxInfo->aConstraintUsage[iCons].argvIndex = iArgv++;
pIdxInfo->aConstraintUsage[iCons].omit = bOmit;
}
}
}else{

View File

@ -29,7 +29,7 @@ proc vtab_command {method args} {
catch { array unset C }
array set C [lindex $clist 0]
if {$C(usable)} {
return "use 0 cost 0 rows 1 idxnum 555 idxstr eq!"
return "omit 0 cost 0 rows 1 idxnum 555 idxstr eq!"
} else {
return "cost 1000000 rows 0 idxnum 0 idxstr scan..."
}
@ -50,11 +50,11 @@ do_eqp_test 1.1 {
0 0 0 {SCAN TABLE x1 VIRTUAL TABLE INDEX 555:eq!}
}
#set sqlite_where_trace 0x3ff
do_eqp_test 1.2 {
SELECT * FROM x1 WHERE a IN ('abc', 'def');
} {
0 0 0 {SCAN TABLE x1 VIRTUAL TABLE INDEX 555:eq!}
0 0 0 {EXECUTE LIST SUBQUERY 1}
}
finish_test