1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-07 02:42:48 +03:00

Enhance the vtab interface to handle IS, !=, IS NOT, IS NULL and IS NOT NULL

constraints.

FossilOrigin-Name: 34c8e952616013deb6fffec701ac5989afac9bef1bf92458a2e4ba92c7ee924f
This commit is contained in:
dan
2017-09-09 19:41:12 +00:00
parent 2158a0c7ac
commit d03024d814
9 changed files with 359 additions and 103 deletions

View File

@@ -897,17 +897,18 @@ static int echoBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo){
case SQLITE_INDEX_CONSTRAINT_REGEXP:
zOp = "regexp"; break;
}
if( zOp[0]=='L' ){
zNew = sqlite3_mprintf(" %s %s LIKE (SELECT '%%'||?||'%%')",
zSep, zNewCol);
} else {
zNew = sqlite3_mprintf(" %s %s %s ?", zSep, zNewCol, zOp);
if( zOp ){
if( zOp[0]=='L' ){
zNew = sqlite3_mprintf(" %s %s LIKE (SELECT '%%'||?||'%%')",
zSep, zNewCol);
} else {
zNew = sqlite3_mprintf(" %s %s %s ?", zSep, zNewCol, zOp);
}
string_concat(&zQuery, zNew, 1, &rc);
zSep = "AND";
pUsage->argvIndex = ++nArg;
pUsage->omit = 1;
}
string_concat(&zQuery, zNew, 1, &rc);
zSep = "AND";
pUsage->argvIndex = ++nArg;
pUsage->omit = 1;
}
}