mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-18 10:21:03 +03:00
Changes to allow DELETE operations on virtual tables to use the onepass strategy under some circumstances.
FossilOrigin-Name: e73f919fae1833c6ffb36eddbc76d9a8d9324214
This commit is contained in:
10
src/where.c
10
src/where.c
@@ -2832,6 +2832,7 @@ static int whereLoopAddVirtual(
|
||||
pIdxInfo->orderByConsumed = 0;
|
||||
pIdxInfo->estimatedCost = SQLITE_BIG_DBL / (double)2;
|
||||
pIdxInfo->estimatedRows = 25;
|
||||
pIdxInfo->flags = 0;
|
||||
rc = vtabBestIndex(pParse, pTab, pIdxInfo);
|
||||
if( rc ) goto whereLoopAddVtab_exit;
|
||||
pIdxCons = *(struct sqlite3_index_constraint**)&pIdxInfo->aConstraint;
|
||||
@@ -2877,6 +2878,7 @@ static int whereLoopAddVirtual(
|
||||
** (2) Multiple outputs from a single IN value will not merge
|
||||
** together. */
|
||||
pIdxInfo->orderByConsumed = 0;
|
||||
pIdxInfo->flags &= ~SQLITE_INDEX_SCAN_UNIQUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2892,6 +2894,14 @@ static int whereLoopAddVirtual(
|
||||
pNew->rSetup = 0;
|
||||
pNew->rRun = sqlite3LogEstFromDouble(pIdxInfo->estimatedCost);
|
||||
pNew->nOut = sqlite3LogEst(pIdxInfo->estimatedRows);
|
||||
|
||||
/* Set the WHERE_ONEROW flag if the xBestIndex() method indicated
|
||||
** that the scan will visit at most one row. Clear it otherwise. */
|
||||
if( pIdxInfo->flags & SQLITE_INDEX_SCAN_UNIQUE ){
|
||||
pNew->wsFlags |= WHERE_ONEROW;
|
||||
}else{
|
||||
pNew->wsFlags &= ~WHERE_ONEROW;
|
||||
}
|
||||
whereLoopInsert(pBuilder, pNew);
|
||||
if( pNew->u.vtab.needFree ){
|
||||
sqlite3_free(pNew->u.vtab.idxStr);
|
||||
|
||||
Reference in New Issue
Block a user