line |
true |
false |
branch |
68
|
36 |
108 |
if( pExpr==0 || nSlot<1 ) return 0; |
|
0 |
36 |
if( pExpr==0 || nSlot<1 ) return 0; |
69
|
36 |
0 |
if( nSlot==1 || pExpr->op!=TK_AND ){ |
|
33 |
3 |
if( nSlot==1 || pExpr->op!=TK_AND ){ |
73
|
3 |
0 |
if( pExpr->pLeft->op!=TK_AND ){ |
94
|
194 |
119 |
for(i=0; in; i++){ |
95
|
190 |
4 |
if( pMaskSet->ix[i]==iCursor ) return 1<
|
97
|
119 |
0 |
if( i==pMaskSet->n && iix) ){ |
|
119 |
0 |
if( i==pMaskSet->n && iix) ){ |
124
|
16 |
166 |
if( p==0 ) return 0; |
125
|
71 |
95 |
if( p->op==TK_COLUMN ){ |
127
|
0 |
71 |
if( mask==0 ) mask = -1; |
130
|
23 |
72 |
if( p->pRight ){ |
133
|
33 |
62 |
if( p->pLeft ){ |
136
|
9 |
86 |
if( p->pList ){ |
138
|
18 |
9 |
for(i=0; ipList->nExpr; i++){ |
151
|
29 |
7 |
switch( op ){ |
178
|
29 |
7 |
if( allowedOp(pExpr->op) && (pInfo->prereqRight & pInfo->prereqLeft)==0 ){ |
|
29 |
0 |
if( allowedOp(pExpr->op) && (pInfo->prereqRight & pInfo->prereqLeft)==0 ){ |
179
|
23 |
6 |
if( pExpr->pRight && pExpr->pRight->op==TK_COLUMN ){ |
|
1 |
22 |
if( pExpr->pRight && pExpr->pRight->op==TK_COLUMN ){ |
183
|
29 |
0 |
if( pExpr->pLeft->op==TK_COLUMN ){ |
228
|
7 |
1 |
for(i=0; inExpr; i++){ |
230
|
0 |
7 |
if( (pOrderBy->a[i].sortOrder & SQLITE_SO_DIRMASK)!=sortOrder ){ |
235
|
0 |
7 |
if( (pOrderBy->a[i].sortOrder & SQLITE_SO_TYPEMASK)!=SQLITE_SO_UNK ){ |
240
|
4 |
3 |
if( p->op!=TK_COLUMN || p->iTable!=base ){ |
|
0 |
4 |
if( p->op!=TK_COLUMN || p->iTable!=base ){ |
252
|
0 |
1 |
for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){ |
254
|
0 |
0 |
if( pIdx->nColumn < nEqCol || pIdx->nColumn < nExpr ) continue; |
|
0 |
0 |
if( pIdx->nColumn < nEqCol || pIdx->nColumn < nExpr ) continue; |
255
|
0 |
0 |
for(i=j=0; i
|
256
|
0 |
0 |
if( pPreferredIdx->aiColumn[i]!=pIdx->aiColumn[i] ) break; |
257
|
0 |
0 |
if( ja[j].pExpr->iColumn==pIdx->aiColumn[i] ){ j++; } |
|
0 |
0 |
if( ja[j].pExpr->iColumn==pIdx->aiColumn[i] ){ j++; } |
259
|
0 |
0 |
if( i
|
260
|
0 |
0 |
for(i=0; i+j
|
261
|
0 |
0 |
if( pOrderBy->a[i+j].pExpr->iColumn!=pIdx->aiColumn[i+nEqCol] ) break; |
263
|
0 |
0 |
if( i+j>=nExpr ){ |
265
|
0 |
0 |
if( pIdx==pPreferredIdx ) break; |
268
|
0 |
1 |
if( pMatch && pbRev ){ |
|
0 |
0 |
if( pMatch && pbRev ){ |
298
|
0 |
0 |
if( pLevel->iLeftJoin==0 || ExprHasProperty(pExpr, EP_FromJoin) ){ |
|
0 |
0 |
if( pLevel->iLeftJoin==0 || ExprHasProperty(pExpr, EP_FromJoin) ){ |
413
|
0 |
141 |
if( nExpr==ARRAYSIZE(aExpr) ){ |
423
|
0 |
141 |
if( sqlite_malloc_failed ){ |
435
|
33 |
108 |
if( pWhere && (pTabList->nSrc==0 || sqliteExprIsConstant(pWhere)) ){ |
|
33 |
0 |
if( pWhere && (pTabList->nSrc==0 || sqliteExprIsConstant(pWhere)) ){ |
|
0 |
33 |
if( pWhere && (pTabList->nSrc==0 || sqliteExprIsConstant(pWhere)) ){ |
442
|
36 |
141 |
for(i=0; i
|
448
|
0 |
36 |
if( pParse->trigStack ){ |
450
|
0 |
0 |
if( (x = pParse->trigStack->newIdx) >= 0 ){ |
456
|
0 |
0 |
if( (x = pParse->trigStack->oldIdx) >= 0 ){ |
482
|
119 |
141 |
for(i=0; inSrc && i
|
|
119 |
0 |
for(i=0; inSrc && i
|
503
|
37 |
119 |
for(j=0; j
|
504
|
29 |
8 |
if( aExpr[j].idxLeft==iCur && aExpr[j].p->pLeft->iColumn<0 |
|
0 |
29 |
if( aExpr[j].idxLeft==iCur && aExpr[j].p->pLeft->iColumn<0 |
505
|
0 |
0 |
&& (aExpr[j].prereqRight & loopMask)==aExpr[j].prereqRight ){ |
515
|
1 |
36 |
if( aExpr[j].idxRight==iCur && aExpr[j].p->pRight->iColumn<0 |
|
0 |
1 |
if( aExpr[j].idxRight==iCur && aExpr[j].p->pRight->iColumn<0 |
516
|
0 |
0 |
&& (aExpr[j].prereqLeft & loopMask)==aExpr[j].prereqLeft ){ |
526
|
0 |
119 |
if( iDirectEq[i]>=0 ){ |
557
|
1 |
119 |
for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){ |
564
|
0 |
1 |
if( pIdx->nColumn>32 ) continue; /* Ignore indices too many columns */ |
565
|
0 |
1 |
for(j=0; j
|
566
|
0 |
0 |
if( aExpr[j].idxLeft==iCur |
567
|
0 |
0 |
&& (aExpr[j].prereqRight & loopMask)==aExpr[j].prereqRight ){ |
570
|
0 |
0 |
for(k=0; knColumn; k++){ |
571
|
0 |
0 |
if( pIdx->aiColumn[k]==iColumn ){ |
574
|
0 |
0 |
if( k==0 ) inMask |= 1; |
601
|
0 |
0 |
if( aExpr[j].idxRight==iCur |
602
|
0 |
0 |
&& (aExpr[j].prereqLeft & loopMask)==aExpr[j].prereqLeft ){ |
605
|
0 |
0 |
for(k=0; knColumn; k++){ |
606
|
0 |
0 |
if( pIdx->aiColumn[k]==iColumn ){ |
637
|
1 |
0 |
for(nEq=0; nEqnColumn; nEq++){ |
639
|
1 |
0 |
if( (m & eqMask)!=m ) break; |
643
|
0 |
1 |
if( m & ltMask ) score++; /* Increase score for a < constraint */ |
644
|
0 |
1 |
if( m & gtMask ) score+=2; /* Increase score for a > constraint */ |
645
|
1 |
0 |
if( score==0 && inMask ) score = 4; /* Default score for IN constraint */ |
|
0 |
1 |
if( score==0 && inMask ) score = 4; /* Default score for IN constraint */ |
646
|
0 |
1 |
if( score>bestScore ){ |
655
|
0 |
119 |
if( pBestIdx ){ |
664
|
133 |
8 |
if( ppOrderBy && *ppOrderBy && pTabList->nSrc>0 ){ |
|
4 |
129 |
if( ppOrderBy && *ppOrderBy && pTabList->nSrc>0 ){ |
|
4 |
0 |
if( ppOrderBy && *ppOrderBy && pTabList->nSrc>0 ){ |
672
|
0 |
4 |
if( pIdx && pWInfo->a[0].score==4 ){ |
|
0 |
0 |
if( pIdx && pWInfo->a[0].score==4 ){ |
678
|
4 |
0 |
}else if( iDirectEq[0]>=0 || iDirectLt[0]>=0 || iDirectGt[0]>=0 ){ |
|
4 |
0 |
}else if( iDirectEq[0]>=0 || iDirectLt[0]>=0 || iDirectGt[0]>=0 ){ |
|
0 |
4 |
}else if( iDirectEq[0]>=0 || iDirectLt[0]>=0 || iDirectGt[0]>=0 ){ |
688
|
0 |
4 |
if( pSortIdx && (pIdx==0 || pIdx==pSortIdx) ){ |
|
0 |
0 |
if( pSortIdx && (pIdx==0 || pIdx==pSortIdx) ){ |
|
0 |
0 |
if( pSortIdx && (pIdx==0 || pIdx==pSortIdx) ){ |
689
|
0 |
0 |
if( pIdx==0 ){ |
701
|
119 |
141 |
for(i=0; inSrc; i++){ |
706
|
116 |
3 |
if( pTab->isTransient || pTab->pSelect ) continue; |
|
0 |
116 |
if( pTab->isTransient || pTab->pSelect ) continue; |
711
|
0 |
116 |
if( (pIx = pWInfo->a[i].pIdx)!=0 ){ |
720
|
119 |
141 |
for(i=0; inSrc; i++){ |
730
|
1 |
118 |
if( i>0 && (pTabList->a[i-1].jointype & JT_LEFT)!=0 ){ |
|
0 |
1 |
if( i>0 && (pTabList->a[i-1].jointype & JT_LEFT)!=0 ){ |
731
|
0 |
0 |
if( !pParse->nMem ) pParse->nMem++; |
739
|
119 |
0 |
if( i=0 ){ |
|
0 |
119 |
if( i=0 ){ |
750
|
0 |
0 |
if( aExpr[k].idxLeft==iCur ){ |
752
|
0 |
0 |
if( pX->op!=TK_IN ){ |
754
|
0 |
0 |
}else if( pX->pList ){ |
776
|
0 |
119 |
}else if( pIdx!=0 && pLevel->score>0 && pLevel->score%4==0 ){ |
|
0 |
0 |
}else if( pIdx!=0 && pLevel->score>0 && pLevel->score%4==0 ){ |
|
0 |
0 |
}else if( pIdx!=0 && pLevel->score>0 && pLevel->score%4==0 ){ |
784
|
0 |
0 |
for(j=0; j
|
785
|
0 |
0 |
for(k=0; k
|
787
|
0 |
0 |
if( pX==0 ) continue; |
788
|
0 |
0 |
if( aExpr[k].idxLeft==iCur |
789
|
0 |
0 |
&& (aExpr[k].prereqRight & loopMask)==aExpr[k].prereqRight |
790
|
0 |
0 |
&& pX->pLeft->iColumn==pIdx->aiColumn[j] |
792
|
0 |
0 |
if( pX->op==TK_EQ ){ |
797
|
0 |
0 |
if( pX->op==TK_IN && nColumn==1 ){ |
|
0 |
0 |
if( pX->op==TK_IN && nColumn==1 ){ |
798
|
0 |
0 |
if( pX->pList ){ |
815
|
0 |
0 |
if( aExpr[k].idxRight==iCur |
816
|
0 |
0 |
&& aExpr[k].p->op==TK_EQ |
817
|
0 |
0 |
&& (aExpr[k].prereqLeft & loopMask)==aExpr[k].prereqLeft |
818
|
0 |
0 |
&& aExpr[k].p->pRight->iColumn==pIdx->aiColumn[j] |
833
|
0 |
0 |
if( nColumn==pIdx->nColumn || pLevel->bRev ){ |
|
0 |
0 |
if( nColumn==pIdx->nColumn || pLevel->bRev ){ |
842
|
0 |
0 |
if( pLevel->bRev ){ |
859
|
0 |
0 |
if( i==pTabList->nSrc-1 && pushKey ){ |
|
0 |
0 |
if( i==pTabList->nSrc-1 && pushKey ){ |
867
|
119 |
0 |
}else if( i=0 || iDirectGt[i]>=0) ){ |
|
119 |
0 |
}else if( i=0 || iDirectGt[i]>=0) ){ |
|
0 |
119 |
}else if( i=0 || iDirectGt[i]>=0) ){ |
875
|
0 |
0 |
if( iDirectGt[i]>=0 ){ |
880
|
0 |
0 |
if( aExpr[k].idxLeft==iCur ){ |
885
|
0 |
0 |
sqliteVdbeAddOp(v, OP_ForceInt, |
|
0 |
0 |
sqliteVdbeAddOp(v, OP_ForceInt, |
892
|
0 |
0 |
if( iDirectLt[i]>=0 ){ |
897
|
0 |
0 |
if( aExpr[k].idxLeft==iCur ){ |
905
|
0 |
0 |
if( aExpr[k].p->op==TK_LT || aExpr[k].p->op==TK_GT ){ |
|
0 |
0 |
if( aExpr[k].p->op==TK_LT || aExpr[k].p->op==TK_GT ){ |
916
|
0 |
0 |
if( testOp!=OP_Noop ){ |
922
|
119 |
0 |
}else if( pIdx==0 ){ |
956
|
0 |
0 |
for(j=0; j
|
957
|
0 |
0 |
for(k=0; k
|
958
|
0 |
0 |
if( aExpr[k].p==0 ) continue; |
959
|
0 |
0 |
if( aExpr[k].idxLeft==iCur |
960
|
0 |
0 |
&& aExpr[k].p->op==TK_EQ |
961
|
0 |
0 |
&& (aExpr[k].prereqRight & loopMask)==aExpr[k].prereqRight |
962
|
0 |
0 |
&& aExpr[k].p->pLeft->iColumn==pIdx->aiColumn[j] |
968
|
0 |
0 |
if( aExpr[k].idxRight==iCur |
969
|
0 |
0 |
&& aExpr[k].p->op==TK_EQ |
970
|
0 |
0 |
&& (aExpr[k].prereqLeft & loopMask)==aExpr[k].prereqLeft |
971
|
0 |
0 |
&& aExpr[k].p->pRight->iColumn==pIdx->aiColumn[j] |
984
|
0 |
0 |
for(j=0; j
|
1000
|
0 |
0 |
if( (score & 1)!=0 ){ |
1001
|
0 |
0 |
for(k=0; k
|
1003
|
0 |
0 |
if( pExpr==0 ) continue; |
1004
|
0 |
0 |
if( aExpr[k].idxLeft==iCur |
1005
|
0 |
0 |
&& (pExpr->op==TK_LT || pExpr->op==TK_LE) |
|
0 |
0 |
&& (pExpr->op==TK_LT || pExpr->op==TK_LE) |
1006
|
0 |
0 |
&& (aExpr[k].prereqRight & loopMask)==aExpr[k].prereqRight |
1007
|
0 |
0 |
&& pExpr->pLeft->iColumn==pIdx->aiColumn[j] |
1014
|
0 |
0 |
if( aExpr[k].idxRight==iCur |
1015
|
0 |
0 |
&& (pExpr->op==TK_GT || pExpr->op==TK_GE) |
|
0 |
0 |
&& (pExpr->op==TK_GT || pExpr->op==TK_GE) |
1016
|
0 |
0 |
&& (aExpr[k].prereqLeft & loopMask)==aExpr[k].prereqLeft |
1017
|
0 |
0 |
&& pExpr->pRight->iColumn==pIdx->aiColumn[j] |
1027
|
0 |
0 |
testOp = nEqColumn>0 ? OP_IdxGE : OP_Noop; |
1030
|
0 |
0 |
if( testOp!=OP_Noop ){ |
1038
|
0 |
0 |
if( leFlag ){ |
1041
|
0 |
0 |
if( pLevel->bRev ){ |
1046
|
0 |
0 |
}else if( pLevel->bRev ){ |
1059
|
0 |
0 |
if( (score & 2)!=0 ){ |
1060
|
0 |
0 |
for(k=0; k
|
1062
|
0 |
0 |
if( pExpr==0 ) continue; |
1063
|
0 |
0 |
if( aExpr[k].idxLeft==iCur |
1064
|
0 |
0 |
&& (pExpr->op==TK_GT || pExpr->op==TK_GE) |
|
0 |
0 |
&& (pExpr->op==TK_GT || pExpr->op==TK_GE) |
1065
|
0 |
0 |
&& (aExpr[k].prereqRight & loopMask)==aExpr[k].prereqRight |
1066
|
0 |
0 |
&& pExpr->pLeft->iColumn==pIdx->aiColumn[j] |
1073
|
0 |
0 |
if( aExpr[k].idxRight==iCur |
1074
|
0 |
0 |
&& (pExpr->op==TK_LT || pExpr->op==TK_LE) |
|
0 |
0 |
&& (pExpr->op==TK_LT || pExpr->op==TK_LE) |
1075
|
0 |
0 |
&& (aExpr[k].prereqLeft & loopMask)==aExpr[k].prereqLeft |
1076
|
0 |
0 |
&& pExpr->pRight->iColumn==pIdx->aiColumn[j] |
1087
|
0 |
0 |
if( nEqColumn>0 || (score&2)!=0 ){ |
|
0 |
0 |
if( nEqColumn>0 || (score&2)!=0 ){ |
1094
|
0 |
0 |
if( !geFlag ){ |
1097
|
0 |
0 |
if( pLevel->bRev ){ |
1104
|
0 |
0 |
}else if( pLevel->bRev ){ |
1115
|
0 |
0 |
if( testOp!=OP_Noop ){ |
1122
|
0 |
0 |
if( i==pTabList->nSrc-1 && pushKey ){ |
|
0 |
0 |
if( i==pTabList->nSrc-1 && pushKey ){ |
1131
|
0 |
0 |
pLevel->op = pLevel->bRev ? OP_Prev : OP_Next; |
1140
|
37 |
119 |
for(j=0; j
|
1141
|
0 |
37 |
if( aExpr[j].p==0 ) continue; |
1142
|
1 |
36 |
if( (aExpr[j].prereqAll & loopMask)!=aExpr[j].prereqAll ) continue; |
1143
|
0 |
36 |
if( pLevel->iLeftJoin && !ExprHasProperty(aExpr[j].p,EP_FromJoin) ){ |
|
0 |
0 |
if( pLevel->iLeftJoin && !ExprHasProperty(aExpr[j].p,EP_FromJoin) ){ |
1146
|
0 |
36 |
if( haveKey ){ |
1158
|
0 |
119 |
if( pLevel->iLeftJoin ){ |
1162
|
0 |
0 |
for(j=0; j
|
1163
|
0 |
0 |
if( aExpr[j].p==0 ) continue; |
1164
|
0 |
0 |
if( (aExpr[j].prereqAll & loopMask)!=aExpr[j].prereqAll ) continue; |
1165
|
0 |
0 |
if( haveKey ){ |
1179
|
6 |
135 |
if( pushKey && !haveKey ){ |
|
6 |
0 |
if( pushKey && !haveKey ){ |
1196
|
119 |
141 |
for(i=pTabList->nSrc-1; i>=0; i--){ |
1199
|
119 |
0 |
if( pLevel->op!=OP_Noop ){ |
1203
|
0 |
119 |
if( pLevel->inOp!=OP_Noop ){ |
1206
|
0 |
119 |
if( pLevel->iLeftJoin ){ |
1211
|
0 |
0 |
if( pLevel->iCur>=0 ){ |
1218
|
119 |
141 |
for(i=0; inSrc; i++){ |
1221
|
116 |
3 |
if( pTab->isTransient || pTab->pSelect ) continue; |
|
0 |
116 |
if( pTab->isTransient || pTab->pSelect ) continue; |
1224
|
0 |
116 |
if( pLevel->pIdx!=0 ){ |