Lines Matching refs:pIndex
15767 Index *pIndex; /* List of SQL indexes on this table. */ member
87516 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
95019 for(pIdx=pTab->pIndex; pIdx && eType==0; pIdx=pIdx->pNext){
98664 if( pNew->pIndex ){
99886 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
100290 Index *pIndex /* Handle extra flags for this index, if not NULL */
100320 assert( pIndex!=0 ); {
100322 if( pIndex ){
100324 pIndex->bUnordered = 0;
100325 pIndex->noSkipScan = 0;
100328 pIndex->bUnordered = 1;
100330 pIndex->szIdxRow = sqlite3LogEst(sqlite3Atoi(z+3));
100332 pIndex->noSkipScan = 1;
100336 pIndex->pTable->costMult = sqlite3LogEst(sqlite3Atoi(z+9));
100358 Index *pIndex;
100373 pIndex = 0;
100375 pIndex = sqlite3PrimaryKeyIndex(pTable);
100377 pIndex = sqlite3FindIndex(pInfo->db, argv[1], pInfo->zDatabase);
100381 if( pIndex ){
100383 int nCol = pIndex->nKeyCol+1;
100388 if( pIndex->aiRowEst==0 ){
100389 pIndex->aiRowEst = (tRowcnt*)sqlite3MallocZero(sizeof(tRowcnt) * nCol);
100390 if( pIndex->aiRowEst==0 ) sqlite3OomFault(pInfo->db);
100392 aiRowEst = pIndex->aiRowEst;
100394 pIndex->bUnordered = 0;
100395 decodeIntArray((char*)z, nCol, aiRowEst, pIndex->aiRowLogEst, pIndex);
100396 pIndex->hasStat1 = 1;
100397 if( pIndex->pPartIdxWhere==0 ){
100398 pTable->nRowLogEst = pIndex->aiRowLogEst[0];
102079 Index *pIndex;
102084 pIndex = sqlite3HashInsert(pHash, zIdxName, 0);
102085 if( ALWAYS(pIndex) ){
102086 if( pIndex->pTable->pIndex==pIndex ){
102087 pIndex->pTable->pIndex = pIndex->pNext;
102092 p = pIndex->pTable->pIndex;
102093 while( ALWAYS(p) && p->pNext!=pIndex ){ p = p->pNext; }
102094 if( ALWAYS(p && p->pNext==pIndex) ){
102095 p->pNext = pIndex->pNext;
102098 freeIndex(db, pIndex);
102218 Index *pIndex, *pNext;
102231 for(pIndex = pTable->pIndex; pIndex; pIndex=pNext){
102232 pNext = pIndex->pNext;
102233 assert( pIndex->pSchema==pTable->pSchema
102234 || (IsVirtual(pTable) && pIndex->idxType!=SQLITE_IDXTYPE_APPDEF) );
102236 char *zName = pIndex->zName;
102238 &pIndex->pSchema->idxHash, zName, 0
102240 assert( db==0 || sqlite3SchemaMutexHeld(db, 0, pIndex->pSchema) );
102241 assert( pOld==pIndex || pOld==0 );
102243 freeIndex(db, pIndex);
102431 for(p=pTab->pIndex; p && !IsPrimaryKeyIndex(p); p=p->pNext){}
103033 for(pIdx=p->pIndex; pIdx; pIdx=pIdx->pNext){
103396 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
103520 for(pIdx=p->pIndex; pIdx; pIdx=pIdx->pNext){
104015 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
104389 static void sqlite3RefillIndex(Parse *pParse, Index *pIndex, int memRootPage){
104390 Table *pTab = pIndex->pTable; /* The table that is indexed */
104402 int iDb = sqlite3SchemaToIndex(db, pIndex->pSchema);
104405 if( sqlite3AuthCheck(pParse, SQLITE_REINDEX, pIndex->zName, 0,
104419 tnum = pIndex->tnum;
104421 pKey = sqlite3KeyInfoOfIndex(pParse, pIndex);
104426 sqlite3VdbeAddOp4(v, OP_SorterOpen, iSorter, 0, pIndex->nKeyCol, (char*)
104435 sqlite3GenerateIndexKey(pParse,pIndex,iTab,regRecord,0,&iPartIdxLabel,0,0);
104446 if( IsUniqueIndex(pIndex) ){
104451 pIndex->nKeyCol); VdbeCoverage(v);
104452 sqlite3UniqueConstraint(pParse, OE_Abort, pIndex);
104530 Index *pIndex = 0; /* The index to be created */
104670 for(pLoop=pTab->pIndex, n=1; pLoop; pLoop=pLoop->pNext, n++){}
104732 pIndex = sqlite3AllocateIndexObject(db, pList->nExpr + nExtraCol,
104737 assert( EIGHT_BYTE_ALIGNMENT(pIndex->aiRowLogEst) );
104738 assert( EIGHT_BYTE_ALIGNMENT(pIndex->azColl) );
104739 pIndex->zName = zExtra;
104741 memcpy(pIndex->zName, zName, nName+1);
104742 pIndex->pTable = pTab;
104743 pIndex->onError = (u8)onError;
104744 pIndex->uniqNotNull = onError!=OE_None;
104745 pIndex->idxType = idxType;
104746 pIndex->pSchema = db->aDb[iDb].pSchema;
104747 pIndex->nKeyCol = pList->nExpr;
104750 pIndex->pPartIdxWhere = pPIWhere;
104787 if( pIndex->aColExpr==0 ){
104789 pIndex->aColExpr = pCopy;
104796 pIndex->aiColumn[i] = XN_EXPR;
104797 pIndex->uniqNotNull = 0;
104804 pIndex->uniqNotNull = 0;
104806 pIndex->aiColumn[i] = (i16)j;
104825 pIndex->azColl[i] = zColl;
104827 pIndex->aSortOrder[i] = (u8)requestedSortOrder;
104838 if( hasColumn(pIndex->aiColumn, pIndex->nKeyCol, x) ){
104839 pIndex->nColumn--;
104841 pIndex->aiColumn[i] = x;
104842 pIndex->azColl[i] = pPk->azColl[j];
104843 pIndex->aSortOrder[i] = pPk->aSortOrder[j];
104847 assert( i==pIndex->nColumn );
104849 pIndex->aiColumn[i] = XN_ROWID;
104850 pIndex->azColl[i] = sqlite3StrBINARY;
104852 sqlite3DefaultRowEst(pIndex);
104853 if( pParse->pNewTable==0 ) estimateIndexWidth(pIndex);
104858 || pTab->iPKey<0 || sqlite3ColumnOfIndex(pIndex, pTab->iPKey)>=0 );
104859 if( pTblName!=0 && pIndex->nColumn>=pTab->nCol ){
104860 pIndex->isCovering = 1;
104863 if( sqlite3ColumnOfIndex(pIndex,j)>=0 ) continue;
104864 pIndex->isCovering = 0;
104892 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
104896 assert( IsUniqueIndex(pIndex) );
104898 if( pIdx->nKeyCol!=pIndex->nKeyCol ) continue;
104903 if( pIdx->aiColumn[k]!=pIndex->aiColumn[k] ) break;
104905 z2 = pIndex->azColl[k];
104909 if( pIdx->onError!=pIndex->onError ){
104917 if( !(pIdx->onError==OE_Default || pIndex->onError==OE_Default) ){
104922 pIdx->onError = pIndex->onError;
104938 assert( sqlite3SchemaMutexHeld(db, 0, pIndex->pSchema) );
104939 p = sqlite3HashInsert(&pIndex->pSchema->idxHash,
104940 pIndex->zName, pIndex);
104942 assert( p==pIndex ); /* Malloc must have failed */
104948 pIndex->tnum = db->init.newTnum;
104981 pIndex->tnum = sqlite3VdbeAddOp0(v, OP_Noop);
105004 pIndex->zName,
105015 sqlite3RefillIndex(pParse, pIndex, iMem);
105018 sqlite3MPrintf(db, "name='%q' AND type='index'", pIndex->zName));
105022 sqlite3VdbeJumpHere(v, pIndex->tnum);
105032 if( onError!=OE_Replace || pTab->pIndex==0
105033 || pTab->pIndex->onError==OE_Replace){
105034 pIndex->pNext = pTab->pIndex;
105035 pTab->pIndex = pIndex;
105037 Index *pOther = pTab->pIndex;
105041 pIndex->pNext = pOther->pNext;
105042 pOther->pNext = pIndex;
105044 pIndex = 0;
105049 if( pIndex ) freeIndex(db, pIndex);
105107 Index *pIndex;
105120 pIndex = sqlite3FindIndex(db, pName->a[0].zName, pName->a[0].zDatabase);
105121 if( pIndex==0 ){
105130 if( pIndex->idxType!=SQLITE_IDXTYPE_APPDEF ){
105135 iDb = sqlite3SchemaToIndex(db, pIndex->pSchema);
105139 Table *pTab = pIndex->pTable;
105146 if( sqlite3AuthCheck(pParse, code, pIndex->zName, pTab->zName, zDb) ){
105158 db->aDb[iDb].zDbSName, MASTER_NAME, pIndex->zName
105160 sqlite3ClearStatTables(pParse, iDb, "idx", pIndex->zName);
105162 destroyRootPage(pParse, pIndex->tnum, iDb);
105163 sqlite3VdbeAddOp4(v, OP_DropIndex, iDb, 0, 0, pIndex->zName, 0);
105839 static int collationMatch(const char *zColl, Index *pIndex){
105842 for(i=0; i<pIndex->nColumn; i++){
105843 const char *z = pIndex->azColl[i];
105844 assert( z!=0 || pIndex->aiColumn[i]<0 );
105845 if( pIndex->aiColumn[i]>=0 && 0==sqlite3StrICmp(z, zColl) ){
105859 Index *pIndex; /* An index associated with pTab */
105861 for(pIndex=pTab->pIndex; pIndex; pIndex=pIndex->pNext){
105862 if( zColl==0 || collationMatch(zColl, pIndex) ){
105865 sqlite3RefillIndex(pParse, pIndex, -1);
105914 Index *pIndex; /* An index associated with pTab */
105952 pIndex = sqlite3FindIndex(db, z, zDb);
105954 if( pIndex ){
105956 sqlite3RefillIndex(pParse, pIndex, -1);
106896 for(nIdx=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, nIdx++){
106972 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
107396 for(i=0, pIdx=pTab->pIndex; pIdx; i++, pIdx=pIdx->pNext){
109640 for(pIdx=pParent->pIndex; pIdx; pIdx=pIdx->pNext){
111014 Index *pIndex;
111019 for(pIndex=pTab->pIndex; pIndex; pIndex=pIndex->pNext){
111020 if( tnum==pIndex->tnum ){
111629 for(i=0, pIdx=pTab->pIndex; i<nIdx; pIdx=pIdx->pNext, i++){
112224 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
112291 if( pTab->pIndex ){
112319 for(ix=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, ix++){
112570 for(i=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, i++){
112681 for(i=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, i++){
112925 for(pDestIdx=pDest->pIndex; pDestIdx; pDestIdx=pDestIdx->pNext){
112929 for(pSrcIdx=pSrc->pIndex; pSrcIdx; pSrcIdx=pSrcIdx->pNext){
112975 (pDest->iPKey<0 && pDest->pIndex!=0) /* (1) */
113011 }else if( pDest->pIndex==0 ){
113035 for(pDestIdx=pDest->pIndex; pDestIdx; pDestIdx=pDestIdx->pNext){
113037 for(pSrcIdx=pSrc->pIndex; ALWAYS(pSrcIdx); pSrcIdx=pSrcIdx->pNext){
116428 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
116484 for(pIdx=pTab->pIndex, i=0; pIdx; pIdx=pIdx->pNext, i++){
116804 for(nIdx=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, nIdx++){ cnt++; }
116813 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
116853 for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){
116906 for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){
116957 for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){
117300 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
117895 Index *pIndex;
117896 pIndex = sqlite3FindIndex(db, argv[0], db->aDb[iDb].zDbSName);
117897 if( pIndex==0 ){
117904 }else if( sqlite3GetInt32(argv[1], &pIndex->tnum)==0 ){
122675 for(pIdx=pTab->pIndex;
124636 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
126284 for(nIdx=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, nIdx++){
126376 for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){
127697 assert( 0==pTable->pIndex );
128137 assert( pTab->pIndex==0 );
128147 pIdx = pNew->pIndex;
128150 pTab->pIndex = pIdx;
128151 pNew->pIndex = 0;
128755 Index *pIndex; /* Index used, or NULL */
129256 Index *pIndex = pLoop->u.btree.pIndex;
129264 const char *z = explainIndexColumnName(pIndex, i);
129271 explainAppendTerm(pStr, pIndex, pLoop->u.btree.nBtm, j, i, ">");
129275 explainAppendTerm(pStr, pIndex, pLoop->u.btree.nTop, j, i, "<");
129336 assert( pLoop->u.btree.pIndex!=0 );
129337 pIdx = pLoop->u.btree.pIndex;
129409 if( (pLoop->wsFlags & WHERE_VIRTUALTABLE)==0 && pLoop->u.btree.pIndex!=0 ){
129410 zObj = pLoop->u.btree.pIndex->zName;
129689 && pLoop->u.btree.pIndex!=0
129690 && pLoop->u.btree.pIndex->aSortOrder[iEq]
129847 pIdx = pLoop->u.btree.pIndex;
130100 sHint.pIdx = pLoop->u.btree.pIndex;
130687 pIdx = pLoop->u.btree.pIndex;
131191 && (ii==0 || pSubLoop->u.btree.pIndex==pCov)
131192 && (HasRowid(pTab) || !IsPrimaryKeyIndex(pSubLoop->u.btree.pIndex))
131195 pCov = pSubLoop->u.btree.pIndex;
132286 for(pIdx=pFrom->a[i].pTab->pIndex; pIdx; pIdx=pIdx->pNext){
133405 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
133662 pLoop->u.btree.pIndex = pIdx;
134227 Index *p = pLoop->u.btree.pIndex;
134344 Index *p = pLoop->u.btree.pIndex;
134517 Index *p = pBuilder->pNew->u.btree.pIndex;
134581 Index *p = pBuilder->pNew->u.btree.pIndex;
134673 if( p->u.btree.pIndex && (zName = p->u.btree.pIndex->zName)!=0 ){
134729 }else if( (p->wsFlags & WHERE_AUTO_INDEX)!=0 && p->u.btree.pIndex!=0 ){
134730 sqlite3DbFree(db, p->u.btree.pIndex->zColAff);
134731 sqlite3DbFreeNN(db, p->u.btree.pIndex);
134732 p->u.btree.pIndex = 0;
134776 pFrom->u.btree.pIndex = 0;
135085 Index *pIndex = p->u.btree.pIndex;
135086 if( pIndex && pIndex->tnum==0 ){
135087 p->u.btree.pIndex = 0;
135584 Index *pIndex,
135591 if( pIndex->bUnordered ) return 0;
135597 for(jj=0; jj<pIndex->nKeyCol; jj++){
135598 if( pExpr->iColumn==pIndex->aiColumn[jj] ) return 1;
135600 }else if( (aColExpr = pIndex->aColExpr)!=0 ){
135601 for(jj=0; jj<pIndex->nKeyCol; jj++){
135602 if( pIndex->aiColumn[jj]!=XN_EXPR ) continue;
135721 pProbe = pTab->pIndex;
135738 pFirst = pSrc->pTab->pIndex;
135768 pNew->u.btree.pIndex = 0;
135820 pNew->u.btree.pIndex = pProbe;
136454 Index *pIndex; /* The index associated with pLoop */
136544 pIndex = 0;
136547 }else if( (pIndex = pLoop->u.btree.pIndex)==0 || pIndex->bUnordered ){
136550 nKeyCol = pIndex->nKeyCol;
136551 nColumn = pIndex->nColumn;
136552 assert( nColumn==nKeyCol+1 || !HasRowid(pIndex->pTable) );
136553 assert( pIndex->aiColumn[nColumn-1]==XN_ROWID
136554 || !HasRowid(pIndex->pTable));
136555 isOrderDistinct = IsUniqueIndex(pIndex);
136605 if( pIndex ){
136606 iColumn = pIndex->aiColumn[j];
136607 revIdx = pIndex->aSortOrder[j];
136608 if( iColumn==pIndex->pTable->iPKey ) iColumn = XN_ROWID;
136620 && pIndex->pTable->aCol[iColumn].notNull==0
136640 Expr *pIdxExpr = pIndex->aColExpr->a[j].pExpr;
136647 if( sqlite3StrICmp(pColl->zName, pIndex->azColl[j])!=0 ) continue;
137216 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
137237 pLoop->u.btree.pIndex = pIdx;
137791 if( pLoop->u.btree.pIndex!=0 ){
137806 Index *pIx = pLoop->u.btree.pIndex;
137819 Index *pJ = pTabItem->pTab->pIndex;
137939 && (pIdx = pLoop->u.btree.pIndex)->hasStat1
137988 VdbeComment((v, "next skip-scan on %s", pLoop->u.btree.pIndex->zName));
138061 pIdx = pLoop->u.btree.pIndex;
159734 struct Fts3Index *pIndex = &p->aIndex[i];
159735 if( nToken<pIndex->nPrefix ) continue;
159737 p, iCol, iPos, &pIndex->hPending, zToken, pIndex->nPrefix
190925 Fts5Index *pIndex;
191154 pNew->pIndex = 0;
191684 pExpr->pIndex, p->zTerm, (int)strlen(p->zTerm),
192256 p->pIndex = pIdx;
192634 pNew->pIndex = pExpr->pIndex;
194780 Fts5Index *pIndex; /* Index that owns this iterator */
197190 pNew->pIndex = p;
197451 assert( pIter->pIndex->pConfig->eDetail==FTS5_DETAIL_NONE );
197464 assert( pIter->pIndex->pConfig->eDetail!=FTS5_DETAIL_NONE );
197476 fts5SegiterPoslist(pIter->pIndex, pSeg, 0, &pIter->poslist);
197497 fts5SegiterPoslist(pIter->pIndex, pSeg, pIter->pColset, &pIter->poslist);
197515 assert( pIter->pIndex->pConfig->eDetail==FTS5_DETAIL_COLUMNS );
197557 assert( pIter->pIndex->pConfig->eDetail==FTS5_DETAIL_FULL );
197568 int *pRc = &pIter->pIndex->rc;
197579 fts5SegiterPoslist(pIter->pIndex, pSeg, pColset, &pIter->poslist);
197587 Fts5Config *pConfig = pIter->pIndex->pConfig;
199678 assert( pIter->pIndex->rc==SQLITE_OK );
199679 fts5MultiIterNext(pIter->pIndex, pIter, 0, 0);
199680 return fts5IndexReturn(pIter->pIndex);
199688 Fts5Index *p = pIter->pIndex;
199690 assert( pIter->pIndex->rc==SQLITE_OK );
199702 return fts5IndexReturn(pIter->pIndex);
199712 fts5MultiIterNextFrom(pIter->pIndex, pIter, iMatch);
199713 return fts5IndexReturn(pIter->pIndex);
199732 Fts5Index *pIndex = pIter->pIndex;
199734 fts5CloseReader(pIndex);
200887 Fts5Index *pIndex; /* Full-text index */
201086 sqlite3Fts5IndexClose(pTab->pIndex);
201152 rc = sqlite3Fts5IndexOpen(pConfig, bCreate, &pTab->pIndex, pzErr);
201158 pConfig, pTab->pIndex, bCreate, &pTab->pStorage, pzErr
201171 rc = sqlite3Fts5IndexLoadConfig(pTab->pIndex);
201172 sqlite3Fts5IndexRollback(pTab->pIndex);
201570 rc = sqlite3Fts5ExprFirst(pCsr->pExpr, pTab->pIndex, iRowid, bDesc);
201718 rc = sqlite3Fts5ExprFirst(pExpr, pTab->pIndex, pCsr->iFirstRowid, bDesc);
201748 pCsr->iSpecial = sqlite3Fts5IndexReads(pTab->pIndex);
202181 rc = sqlite3Fts5IndexLoadConfig(pTab->pIndex);
203008 return pTab->pIndex;
203536 Fts5Index *pIndex;
203792 Fts5Index *pIndex,
203809 p->pIndex = pIndex;
203890 Fts5Index *pIdx = pCtx->pStorage->pIndex;
203927 rc = sqlite3Fts5IndexBeginWrite(p->pIndex, 1, iDel);
203994 rc = sqlite3Fts5IndexGetAverages(p->pIndex, &p->nTotalRow, p->aTotalSize);
204019 rc = sqlite3Fts5IndexSetAverages(p->pIndex, buf.p, buf.n);
204091 rc = sqlite3Fts5IndexReinit(p->pIndex);
204121 rc = sqlite3Fts5IndexBeginWrite(p->pIndex, 0, iRowid);
204152 return sqlite3Fts5IndexOptimize(p->pIndex);
204156 return sqlite3Fts5IndexMerge(p->pIndex, nMerge);
204160 return sqlite3Fts5IndexReset(p->pIndex);
204243 rc = sqlite3Fts5IndexBeginWrite(p->pIndex, 0, iRowid);
204472 rc = sqlite3Fts5IndexIntegrityCheck(p->pIndex, ctx.cksum);
204608 rc = sqlite3Fts5IndexSync(p->pIndex);
204616 return sqlite3Fts5IndexRollback(p->pIndex);
204639 rc = sqlite3Fts5IndexSetCookie(p->pIndex, iNew);
206654 Fts5Index *pIndex; /* Associated FTS5 index */
206926 Fts5Index *pIndex = 0;
206946 pIndex = sqlite3Fts5IndexFromCsrid(pTab->pGlobal, iId, &pConfig);
206949 if( rc==SQLITE_OK && pIndex==0 ){
206966 pCsr->pIndex = pIndex;
207224 rc = sqlite3Fts5IndexQuery(pCsr->pIndex, zTerm, nTerm, f, 0, &pCsr->pIter);