aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/select.c3
-rw-r--r--src/sqlite.h.in1
-rw-r--r--src/where.c10
3 files changed, 8 insertions, 6 deletions
diff --git a/src/select.c b/src/select.c
index 02730ac12..5cdef3aed 100644
--- a/src/select.c
+++ b/src/select.c
@@ -4670,11 +4670,12 @@ int sqlite3Select(
**
** (2011-04-15) Do not do a full scan of an unordered index.
**
- ** (2013-10-03) Do not count the entires in a partial index.
+ ** (2013-10-03) Do not count the entries in a partial index.
**
** In practice the KeyInfo structure will not be used. It is only
** passed to keep OP_OpenRead happy.
*/
+ if( !HasRowid(pTab) ) pBest = sqlite3PrimaryKeyIndex(pTab);
for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
if( pIdx->bUnordered==0
&& pIdx->szIdxRow<pTab->szTabRow
diff --git a/src/sqlite.h.in b/src/sqlite.h.in
index 6372ee392..f3466cb25 100644
--- a/src/sqlite.h.in
+++ b/src/sqlite.h.in
@@ -5331,6 +5331,7 @@ struct sqlite3_index_info {
int needToFreeIdxStr; /* Free idxStr using sqlite3_free() if true */
int orderByConsumed; /* True if output is already ordered */
double estimatedCost; /* Estimated cost of using this index */
+ /* Fields below are only available in SQLite 3.8.2 and later */
sqlite3_int64 estimatedRows; /* Estimated number of rows returned */
};
diff --git a/src/where.c b/src/where.c
index efbd31097..60a9471da 100644
--- a/src/where.c
+++ b/src/where.c
@@ -4702,7 +4702,8 @@ static int whereLoopAddBtree(
** pBuilder->pNew->iTab. That table is guaranteed to be a virtual table.
*/
static int whereLoopAddVirtual(
- WhereLoopBuilder *pBuilder /* WHERE clause information */
+ WhereLoopBuilder *pBuilder, /* WHERE clause information */
+ Bitmask mExtra
){
WhereInfo *pWInfo; /* WHERE analysis context */
Parse *pParse; /* The parsing context */
@@ -4792,7 +4793,7 @@ static int whereLoopAddVirtual(
rc = vtabBestIndex(pParse, pTab, pIdxInfo);
if( rc ) goto whereLoopAddVtab_exit;
pIdxCons = *(struct sqlite3_index_constraint**)&pIdxInfo->aConstraint;
- pNew->prereq = 0;
+ pNew->prereq = mExtra;
mxTerm = -1;
assert( pNew->nLSlot>=nConstraint );
for(i=0; i<nConstraint; i++) pNew->aLTerm[i] = 0;
@@ -4919,8 +4920,7 @@ static int whereLoopAddOr(WhereLoopBuilder *pBuilder, Bitmask mExtra){
sCur.n = 0;
#ifndef SQLITE_OMIT_VIRTUALTABLE
if( IsVirtual(pItem->pTab) ){
- rc = whereLoopAddVirtual(&sSubBuild);
- for(i=0; i<sCur.n; i++) sCur.a[i].prereq |= mExtra;
+ rc = whereLoopAddVirtual(&sSubBuild, mExtra);
}else
#endif
{
@@ -4990,7 +4990,7 @@ static int whereLoopAddAll(WhereLoopBuilder *pBuilder){
}
priorJoinType = pItem->jointype;
if( IsVirtual(pItem->pTab) ){
- rc = whereLoopAddVirtual(pBuilder);
+ rc = whereLoopAddVirtual(pBuilder, mExtra);
}else{
rc = whereLoopAddBtree(pBuilder, mExtra);
}