Lines Matching refs:pIdx
442 Index *pIdx /* Must be compatible with this index */ in whereScanInit() argument
454 if( pIdx ){ in whereScanInit()
456 iColumn = pIdx->aiColumn[j]; in whereScanInit()
457 if( iColumn==pIdx->pTable->iPKey ){ in whereScanInit()
460 pScan->idxaff = pIdx->pTable->aCol[iColumn].affinity; in whereScanInit()
461 pScan->zCollName = pIdx->azColl[j]; in whereScanInit()
463 pScan->pIdxExpr = pIdx->aColExpr->a[j].pExpr; in whereScanInit()
464 pScan->zCollName = pIdx->azColl[j]; in whereScanInit()
506 Index *pIdx /* Must be compatible with this index, if not NULL */ in sqlite3WhereFindTerm() argument
512 p = whereScanInit(&scan, pWC, iCur, iColumn, op, pIdx); in sqlite3WhereFindTerm()
538 Index *pIdx, /* Index to match column of */ in findIndexCol() argument
542 const char *zColl = pIdx->azColl[iCol]; in findIndexCol()
548 && p->iColumn==pIdx->aiColumn[iCol] in findIndexCol()
564 static int indexColumnNotNull(Index *pIdx, int iCol){ in indexColumnNotNull() argument
566 assert( pIdx!=0 ); in indexColumnNotNull()
567 assert( iCol>=0 && iCol<pIdx->nColumn ); in indexColumnNotNull()
568 j = pIdx->aiColumn[iCol]; in indexColumnNotNull()
570 return pIdx->pTable->aCol[j].notNull; in indexColumnNotNull()
594 Index *pIdx; in isDistinctRedundant() local
629 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){ in isDistinctRedundant()
630 if( !IsUniqueIndex(pIdx) ) continue; in isDistinctRedundant()
631 if( pIdx->pPartIdxWhere ) continue; in isDistinctRedundant()
632 for(i=0; i<pIdx->nKeyCol; i++){ in isDistinctRedundant()
633 if( 0==sqlite3WhereFindTerm(pWC, iBase, i, ~(Bitmask)0, WO_EQ, pIdx) ){ in isDistinctRedundant()
634 if( findIndexCol(pParse, pDistinct, iBase, pIdx, i)<0 ) break; in isDistinctRedundant()
635 if( indexColumnNotNull(pIdx, i)==0 ) break; in isDistinctRedundant()
638 if( i==pIdx->nKeyCol ){ in isDistinctRedundant()
830 Index *pIdx; /* Object describing the transient index */ in constructAutomaticIndex() local
923 pIdx = sqlite3AllocateIndexObject(pParse->db, nKeyCol+1, 0, &zNotUsed); in constructAutomaticIndex()
924 if( pIdx==0 ) goto end_auto_index_create; in constructAutomaticIndex()
925 pLoop->u.btree.pIndex = pIdx; in constructAutomaticIndex()
926 pIdx->zName = "auto-index"; in constructAutomaticIndex()
927 pIdx->pTable = pTable; in constructAutomaticIndex()
942 pIdx->aiColumn[n] = pTerm->u.x.leftColumn; in constructAutomaticIndex()
945 pIdx->azColl[n] = pColl ? pColl->zName : sqlite3StrBINARY; in constructAutomaticIndex()
956 pIdx->aiColumn[n] = i; in constructAutomaticIndex()
957 pIdx->azColl[n] = sqlite3StrBINARY; in constructAutomaticIndex()
963 pIdx->aiColumn[n] = i; in constructAutomaticIndex()
964 pIdx->azColl[n] = sqlite3StrBINARY; in constructAutomaticIndex()
969 pIdx->aiColumn[n] = XN_ROWID; in constructAutomaticIndex()
970 pIdx->azColl[n] = sqlite3StrBINARY; in constructAutomaticIndex()
976 sqlite3VdbeSetP4KeyInfo(pParse, pIdx); in constructAutomaticIndex()
1002 pParse, pIdx, pLevel->iTabCur, regRecord, 0, 0, 0, 0 in constructAutomaticIndex()
1120 Index *pIdx = pLoop->u.btree.pIndex; in sqlite3ConstructBloomFilter() local
1125 int iCol = pIdx->aiColumn[jj]; in sqlite3ConstructBloomFilter()
1126 assert( pIdx->pTable==pItem->pTab ); in sqlite3ConstructBloomFilter()
1127 sqlite3ExprCodeGetColumnOfTable(v, pIdx->pTable, iCur, iCol,r1+jj); in sqlite3ConstructBloomFilter()
1435 Index *pIdx, /* Index to consider domain of */ in whereKeyStats() argument
1440 IndexSample *aSample = pIdx->aSample; in whereKeyStats()
1454 assert( pIdx->nSample>0 ); in whereKeyStats()
1501 nField = MIN(pRec->nField, pIdx->nSample); in whereKeyStats()
1503 iSample = pIdx->nSample * nField; in whereKeyStats()
1544 assert( i<pIdx->nSample ); in whereKeyStats()
1554 assert( i<=pIdx->nSample && i>=0 ); in whereKeyStats()
1556 assert( i==pIdx->nSample in whereKeyStats()
1588 if( i>=pIdx->nSample ){ in whereKeyStats()
1589 iUpper = pIdx->nRowEst0; in whereKeyStats()
1605 aStat[1] = pIdx->aAvgEq[nField-1]; in whereKeyStats()
1642 char sqlite3IndexColumnAffinity(sqlite3 *db, Index *pIdx, int iCol){ in sqlite3IndexColumnAffinity() argument
1643 assert( iCol>=0 && iCol<pIdx->nColumn ); in sqlite3IndexColumnAffinity()
1644 if( !pIdx->zColAff ){ in sqlite3IndexColumnAffinity()
1645 if( sqlite3IndexAffinityStr(db, pIdx)==0 ) return SQLITE_AFF_BLOB; in sqlite3IndexColumnAffinity()
1647 assert( pIdx->zColAff[iCol]!=0 ); in sqlite3IndexColumnAffinity()
1648 return pIdx->zColAff[iCol]; in sqlite3IndexColumnAffinity()
2713 Index *pIdx, /* The index to be used for a inequality constraint */ in whereRangeVectorLen() argument
2720 nCmp = MIN(nCmp, (pIdx->nColumn - nEq)); in whereRangeVectorLen()
2744 || pLhs->iColumn!=pIdx->aiColumn[i+nEq] in whereRangeVectorLen()
2745 || pIdx->aSortOrder[i+nEq]!=pIdx->aSortOrder[nEq] in whereRangeVectorLen()
2752 idxaff = sqlite3TableColumnAffinity(pIdx->pTable, pLhs->iColumn); in whereRangeVectorLen()
2757 if( sqlite3StrICmp(pColl->zName, pIdx->azColl[i+nEq]) ) break; in whereRangeVectorLen()
3254 Index *pIdx; /* The index */ member
3274 const Index *pIdx; /* The index of interest */ in whereIsCoveringIndexWalkCallback() local
3280 pIdx = pWalk->u.pCovIdxCk->pIdx; in whereIsCoveringIndexWalkCallback()
3281 aiColumn = pIdx->aiColumn; in whereIsCoveringIndexWalkCallback()
3282 nColumn = pIdx->nColumn; in whereIsCoveringIndexWalkCallback()
3307 Index *pIdx, /* Index that is being tested */ in whereIsCoveringIndex() argument
3318 for(i=0; i<pIdx->nColumn; i++){ in whereIsCoveringIndex()
3319 if( pIdx->aiColumn[i]>=BMS-1 ) break; in whereIsCoveringIndex()
3321 if( i>=pIdx->nColumn ){ in whereIsCoveringIndex()
3327 ck.pIdx = pIdx; in whereIsCoveringIndex()
5187 Index *pIdx; in whereShortCut() local
5217 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){ in whereShortCut()
5220 if( !IsUniqueIndex(pIdx) in whereShortCut()
5221 || pIdx->pPartIdxWhere!=0 in whereShortCut()
5222 || pIdx->nKeyCol>ArraySize(pLoop->aLTermSpace) in whereShortCut()
5224 opMask = pIdx->uniqNotNull ? (WO_EQ|WO_IS) : WO_EQ; in whereShortCut()
5225 for(j=0; j<pIdx->nKeyCol; j++){ in whereShortCut()
5226 pTerm = whereScanInit(&scan, pWC, iCur, j, opMask, pIdx); in whereShortCut()
5232 if( j!=pIdx->nKeyCol ) continue; in whereShortCut()
5234 if( pIdx->isCovering || (pItem->colUsed & pIdx->colNotIdxed)==0 ){ in whereShortCut()
5239 pLoop->u.btree.pIndex = pIdx; in whereShortCut()
5489 Index *pIdx, /* The index-on-expression that contains the expressions */ in whereAddIndexedExpr() argument
5496 assert( pIdx->bHasExpr ); in whereAddIndexedExpr()
5497 pTab = pIdx->pTable; in whereAddIndexedExpr()
5498 for(i=0; i<pIdx->nColumn; i++){ in whereAddIndexedExpr()
5500 int j = pIdx->aiColumn[i]; in whereAddIndexedExpr()
5503 pExpr = pIdx->aColExpr->a[i].pExpr; in whereAddIndexedExpr()
5524 p->zIdxName = pIdx->zName; in whereAddIndexedExpr()
6287 Index *pIdx; in sqlite3WhereEnd() local
6292 && (pIdx = pLoop->u.btree.pIndex)->hasStat1 in sqlite3WhereEnd()
6294 && pIdx->aiRowLogEst[n]>=36 in sqlite3WhereEnd()
6426 Index *pIdx = 0; in sqlite3WhereEnd() local
6464 pIdx = pLoop->u.btree.pIndex; in sqlite3WhereEnd()
6466 pIdx = pLevel->u.pCoveringIdx; in sqlite3WhereEnd()
6468 if( pIdx in sqlite3WhereEnd()
6471 if( pWInfo->eOnePass==ONEPASS_OFF || !HasRowid(pIdx->pTable) ){ in sqlite3WhereEnd()
6476 if( pIdx->bHasExpr ){ in sqlite3WhereEnd()
6509 assert( pIdx->pTable==pTab ); in sqlite3WhereEnd()
6523 x = sqlite3TableColumnToIndex(pIdx, x); in sqlite3WhereEnd()