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:
21
src/test8.c
21
src/test8.c
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user