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

Tweaks to the sqlite3_vtab_in() interface.

FossilOrigin-Name: 75040183b8e14f20bfedfdcc1a9fb968f2f0193bc698605d1b4791a3699b93d9
This commit is contained in:
drh
2022-02-01 21:59:43 +00:00
parent a9f18f0172
commit b30298d3ea
5 changed files with 112 additions and 82 deletions

View File

@@ -888,21 +888,21 @@ static int vtabInLoadValue(sqlite3_value *pVal, sqlite3_value **ppOut){
** sqlite3_vtab_in_next() (if bNext!=0).
*/
static int vtabInOp(sqlite3_value *pVal, sqlite3_value **ppOut, int bNext){
int rc = SQLITE_OK;
int rc;
BtCursor *pCsr;
*ppOut = 0;
if( pVal && pVal->uTemp==SQLITE_VTAB_IN_MAGIC ){
BtCursor *pCsr = (BtCursor*)pVal->z;
if( bNext ){
rc = sqlite3BtreeNext(pCsr, 0);
}else{
int dummy = 0;
rc = sqlite3BtreeFirst(pCsr, &dummy);
}
if( rc==SQLITE_OK && sqlite3BtreeEof(pCsr)==0 ){
rc = vtabInLoadValue(pVal, ppOut);
}
if( pVal==0 ) return SQLITE_MISUSE;
if( pVal->uTemp!=SQLITE_VTAB_IN_MAGIC ) return SQLITE_MISUSE;
pCsr = (BtCursor*)pVal->z;
if( bNext ){
rc = sqlite3BtreeNext(pCsr, 0);
}else{
int dummy = 0;
rc = sqlite3BtreeFirst(pCsr, &dummy);
if( rc==SQLITE_OK && sqlite3BtreeEof(pCsr) ) rc = SQLITE_DONE;
}
if( rc==SQLITE_OK ){
rc = vtabInLoadValue(pVal, ppOut);
}
return rc;
}