diff options
Diffstat (limited to 'src/test_bestindex.c')
-rw-r--r-- | src/test_bestindex.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/src/test_bestindex.c b/src/test_bestindex.c index 0e1e86a81..c89cab2e3 100644 --- a/src/test_bestindex.c +++ b/src/test_bestindex.c @@ -305,11 +305,9 @@ static int tclFilter( Tcl_IncrRefCount(pScript); Tcl_ListObjAppendElement(interp, pScript, Tcl_NewStringObj("xFilter", -1)); Tcl_ListObjAppendElement(interp, pScript, Tcl_NewIntObj(idxNum)); - if( idxStr ){ - Tcl_ListObjAppendElement(interp, pScript, Tcl_NewStringObj(idxStr, -1)); - }else{ - Tcl_ListObjAppendElement(interp, pScript, Tcl_NewStringObj("", -1)); - } + Tcl_ListObjAppendElement( + interp, pScript, Tcl_NewStringObj(idxStr ? idxStr : "", -1) + ); pArg = Tcl_NewObj(); Tcl_IncrRefCount(pArg); @@ -530,6 +528,7 @@ static int SQLITE_TCLAPI testBestIndexObj( "distinct", /* 3 */ "in", /* 4 */ "rhs_value", /* 5 */ + "collation", /* 6 */ 0 }; int ii; @@ -610,6 +609,17 @@ static int SQLITE_TCLAPI testBestIndexObj( Tcl_SetObjResult(interp, Tcl_NewStringObj(zVal, -1)); break; } + + case 6: assert( sqlite3_stricmp(azSub[ii], "collation")==0 ); { + int iCons = 0; + const char *zColl = ""; + if( Tcl_GetIntFromObj(interp, objv[2], &iCons) ){ + return TCL_ERROR; + } + zColl = sqlite3_vtab_collation(pIdxInfo, iCons); + Tcl_SetObjResult(interp, Tcl_NewStringObj(zColl, -1)); + break; + } } return TCL_OK; @@ -700,6 +710,10 @@ static int tclBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo){ pIdxInfo->aConstraintUsage[iCons].omit = bOmit; } } + }else + if( sqlite3_stricmp("constraint", zCmd)==0 ){ + rc = SQLITE_CONSTRAINT; + pTab->base.zErrMsg = sqlite3_mprintf("%s", Tcl_GetString(p)); }else{ rc = SQLITE_ERROR; pTab->base.zErrMsg = sqlite3_mprintf("unexpected: %s", zCmd); |