Lines Matching refs:pIndex
15767 Index *pIndex; /* List of SQL indexes on this table. */ member
87532 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
95035 for(pIdx=pTab->pIndex; pIdx && eType==0; pIdx=pIdx->pNext){
98680 if( pNew->pIndex ){
99902 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
100306 Index *pIndex /* Handle extra flags for this index, if not NULL */
100336 assert( pIndex!=0 ); {
100338 if( pIndex ){
100340 pIndex->bUnordered = 0;
100341 pIndex->noSkipScan = 0;
100344 pIndex->bUnordered = 1;
100346 pIndex->szIdxRow = sqlite3LogEst(sqlite3Atoi(z+3));
100348 pIndex->noSkipScan = 1;
100352 pIndex->pTable->costMult = sqlite3LogEst(sqlite3Atoi(z+9));
100374 Index *pIndex;
100389 pIndex = 0;
100391 pIndex = sqlite3PrimaryKeyIndex(pTable);
100393 pIndex = sqlite3FindIndex(pInfo->db, argv[1], pInfo->zDatabase);
100397 if( pIndex ){
100399 int nCol = pIndex->nKeyCol+1;
100404 if( pIndex->aiRowEst==0 ){
100405 pIndex->aiRowEst = (tRowcnt*)sqlite3MallocZero(sizeof(tRowcnt) * nCol);
100406 if( pIndex->aiRowEst==0 ) sqlite3OomFault(pInfo->db);
100408 aiRowEst = pIndex->aiRowEst;
100410 pIndex->bUnordered = 0;
100411 decodeIntArray((char*)z, nCol, aiRowEst, pIndex->aiRowLogEst, pIndex);
100412 pIndex->hasStat1 = 1;
100413 if( pIndex->pPartIdxWhere==0 ){
100414 pTable->nRowLogEst = pIndex->aiRowLogEst[0];
102095 Index *pIndex;
102100 pIndex = sqlite3HashInsert(pHash, zIdxName, 0);
102101 if( ALWAYS(pIndex) ){
102102 if( pIndex->pTable->pIndex==pIndex ){
102103 pIndex->pTable->pIndex = pIndex->pNext;
102108 p = pIndex->pTable->pIndex;
102109 while( ALWAYS(p) && p->pNext!=pIndex ){ p = p->pNext; }
102110 if( ALWAYS(p && p->pNext==pIndex) ){
102111 p->pNext = pIndex->pNext;
102114 freeIndex(db, pIndex);
102234 Index *pIndex, *pNext;
102247 for(pIndex = pTable->pIndex; pIndex; pIndex=pNext){
102248 pNext = pIndex->pNext;
102249 assert( pIndex->pSchema==pTable->pSchema
102250 || (IsVirtual(pTable) && pIndex->idxType!=SQLITE_IDXTYPE_APPDEF) );
102252 char *zName = pIndex->zName;
102254 &pIndex->pSchema->idxHash, zName, 0
102256 assert( db==0 || sqlite3SchemaMutexHeld(db, 0, pIndex->pSchema) );
102257 assert( pOld==pIndex || pOld==0 );
102259 freeIndex(db, pIndex);
102447 for(p=pTab->pIndex; p && !IsPrimaryKeyIndex(p); p=p->pNext){}
103049 for(pIdx=p->pIndex; pIdx; pIdx=pIdx->pNext){
103412 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
103536 for(pIdx=p->pIndex; pIdx; pIdx=pIdx->pNext){
104031 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
104405 static void sqlite3RefillIndex(Parse *pParse, Index *pIndex, int memRootPage){
104406 Table *pTab = pIndex->pTable; /* The table that is indexed */
104418 int iDb = sqlite3SchemaToIndex(db, pIndex->pSchema);
104421 if( sqlite3AuthCheck(pParse, SQLITE_REINDEX, pIndex->zName, 0,
104435 tnum = pIndex->tnum;
104437 pKey = sqlite3KeyInfoOfIndex(pParse, pIndex);
104442 sqlite3VdbeAddOp4(v, OP_SorterOpen, iSorter, 0, pIndex->nKeyCol, (char*)
104451 sqlite3GenerateIndexKey(pParse,pIndex,iTab,regRecord,0,&iPartIdxLabel,0,0);
104462 if( IsUniqueIndex(pIndex) ){
104467 pIndex->nKeyCol); VdbeCoverage(v);
104468 sqlite3UniqueConstraint(pParse, OE_Abort, pIndex);
104546 Index *pIndex = 0; /* The index to be created */
104686 for(pLoop=pTab->pIndex, n=1; pLoop; pLoop=pLoop->pNext, n++){}
104748 pIndex = sqlite3AllocateIndexObject(db, pList->nExpr + nExtraCol,
104753 assert( EIGHT_BYTE_ALIGNMENT(pIndex->aiRowLogEst) );
104754 assert( EIGHT_BYTE_ALIGNMENT(pIndex->azColl) );
104755 pIndex->zName = zExtra;
104757 memcpy(pIndex->zName, zName, nName+1);
104758 pIndex->pTable = pTab;
104759 pIndex->onError = (u8)onError;
104760 pIndex->uniqNotNull = onError!=OE_None;
104761 pIndex->idxType = idxType;
104762 pIndex->pSchema = db->aDb[iDb].pSchema;
104763 pIndex->nKeyCol = pList->nExpr;
104766 pIndex->pPartIdxWhere = pPIWhere;
104803 if( pIndex->aColExpr==0 ){
104805 pIndex->aColExpr = pCopy;
104812 pIndex->aiColumn[i] = XN_EXPR;
104813 pIndex->uniqNotNull = 0;
104820 pIndex->uniqNotNull = 0;
104822 pIndex->aiColumn[i] = (i16)j;
104841 pIndex->azColl[i] = zColl;
104843 pIndex->aSortOrder[i] = (u8)requestedSortOrder;
104854 if( hasColumn(pIndex->aiColumn, pIndex->nKeyCol, x) ){
104855 pIndex->nColumn--;
104857 pIndex->aiColumn[i] = x;
104858 pIndex->azColl[i] = pPk->azColl[j];
104859 pIndex->aSortOrder[i] = pPk->aSortOrder[j];
104863 assert( i==pIndex->nColumn );
104865 pIndex->aiColumn[i] = XN_ROWID;
104866 pIndex->azColl[i] = sqlite3StrBINARY;
104868 sqlite3DefaultRowEst(pIndex);
104869 if( pParse->pNewTable==0 ) estimateIndexWidth(pIndex);
104874 || pTab->iPKey<0 || sqlite3ColumnOfIndex(pIndex, pTab->iPKey)>=0 );
104875 if( pTblName!=0 && pIndex->nColumn>=pTab->nCol ){
104876 pIndex->isCovering = 1;
104879 if( sqlite3ColumnOfIndex(pIndex,j)>=0 ) continue;
104880 pIndex->isCovering = 0;
104908 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
104912 assert( IsUniqueIndex(pIndex) );
104914 if( pIdx->nKeyCol!=pIndex->nKeyCol ) continue;
104919 if( pIdx->aiColumn[k]!=pIndex->aiColumn[k] ) break;
104921 z2 = pIndex->azColl[k];
104925 if( pIdx->onError!=pIndex->onError ){
104933 if( !(pIdx->onError==OE_Default || pIndex->onError==OE_Default) ){
104938 pIdx->onError = pIndex->onError;
104954 assert( sqlite3SchemaMutexHeld(db, 0, pIndex->pSchema) );
104955 p = sqlite3HashInsert(&pIndex->pSchema->idxHash,
104956 pIndex->zName, pIndex);
104958 assert( p==pIndex ); /* Malloc must have failed */
104964 pIndex->tnum = db->init.newTnum;
104997 pIndex->tnum = sqlite3VdbeAddOp0(v, OP_Noop);
105020 pIndex->zName,
105031 sqlite3RefillIndex(pParse, pIndex, iMem);
105034 sqlite3MPrintf(db, "name='%q' AND type='index'", pIndex->zName));
105038 sqlite3VdbeJumpHere(v, pIndex->tnum);
105048 if( onError!=OE_Replace || pTab->pIndex==0
105049 || pTab->pIndex->onError==OE_Replace){
105050 pIndex->pNext = pTab->pIndex;
105051 pTab->pIndex = pIndex;
105053 Index *pOther = pTab->pIndex;
105057 pIndex->pNext = pOther->pNext;
105058 pOther->pNext = pIndex;
105060 pIndex = 0;
105065 if( pIndex ) freeIndex(db, pIndex);
105123 Index *pIndex;
105136 pIndex = sqlite3FindIndex(db, pName->a[0].zName, pName->a[0].zDatabase);
105137 if( pIndex==0 ){
105146 if( pIndex->idxType!=SQLITE_IDXTYPE_APPDEF ){
105151 iDb = sqlite3SchemaToIndex(db, pIndex->pSchema);
105155 Table *pTab = pIndex->pTable;
105162 if( sqlite3AuthCheck(pParse, code, pIndex->zName, pTab->zName, zDb) ){
105174 db->aDb[iDb].zDbSName, MASTER_NAME, pIndex->zName
105176 sqlite3ClearStatTables(pParse, iDb, "idx", pIndex->zName);
105178 destroyRootPage(pParse, pIndex->tnum, iDb);
105179 sqlite3VdbeAddOp4(v, OP_DropIndex, iDb, 0, 0, pIndex->zName, 0);
105855 static int collationMatch(const char *zColl, Index *pIndex){
105858 for(i=0; i<pIndex->nColumn; i++){
105859 const char *z = pIndex->azColl[i];
105860 assert( z!=0 || pIndex->aiColumn[i]<0 );
105861 if( pIndex->aiColumn[i]>=0 && 0==sqlite3StrICmp(z, zColl) ){
105875 Index *pIndex; /* An index associated with pTab */
105877 for(pIndex=pTab->pIndex; pIndex; pIndex=pIndex->pNext){
105878 if( zColl==0 || collationMatch(zColl, pIndex) ){
105881 sqlite3RefillIndex(pParse, pIndex, -1);
105930 Index *pIndex; /* An index associated with pTab */
105968 pIndex = sqlite3FindIndex(db, z, zDb);
105970 if( pIndex ){
105972 sqlite3RefillIndex(pParse, pIndex, -1);
106912 for(nIdx=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, nIdx++){
106988 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
107412 for(i=0, pIdx=pTab->pIndex; pIdx; i++, pIdx=pIdx->pNext){
109656 for(pIdx=pParent->pIndex; pIdx; pIdx=pIdx->pNext){
111030 Index *pIndex;
111035 for(pIndex=pTab->pIndex; pIndex; pIndex=pIndex->pNext){
111036 if( tnum==pIndex->tnum ){
111645 for(i=0, pIdx=pTab->pIndex; i<nIdx; pIdx=pIdx->pNext, i++){
112240 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
112307 if( pTab->pIndex ){
112335 for(ix=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, ix++){
112586 for(i=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, i++){
112697 for(i=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, i++){
112941 for(pDestIdx=pDest->pIndex; pDestIdx; pDestIdx=pDestIdx->pNext){
112945 for(pSrcIdx=pSrc->pIndex; pSrcIdx; pSrcIdx=pSrcIdx->pNext){
112991 (pDest->iPKey<0 && pDest->pIndex!=0) /* (1) */
113027 }else if( pDest->pIndex==0 ){
113051 for(pDestIdx=pDest->pIndex; pDestIdx; pDestIdx=pDestIdx->pNext){
113053 for(pSrcIdx=pSrc->pIndex; ALWAYS(pSrcIdx); pSrcIdx=pSrcIdx->pNext){
116444 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
116500 for(pIdx=pTab->pIndex, i=0; pIdx; pIdx=pIdx->pNext, i++){
116820 for(nIdx=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, nIdx++){ cnt++; }
116829 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
116869 for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){
116922 for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){
116973 for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){
117316 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
117911 Index *pIndex;
117912 pIndex = sqlite3FindIndex(db, argv[0], db->aDb[iDb].zDbSName);
117913 if( pIndex==0 ){
117920 }else if( sqlite3GetInt32(argv[1], &pIndex->tnum)==0 ){
122691 for(pIdx=pTab->pIndex;
124652 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
126300 for(nIdx=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, nIdx++){
126392 for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){
127713 assert( 0==pTable->pIndex );
128153 assert( pTab->pIndex==0 );
128163 pIdx = pNew->pIndex;
128166 pTab->pIndex = pIdx;
128167 pNew->pIndex = 0;
128771 Index *pIndex; /* Index used, or NULL */
129272 Index *pIndex = pLoop->u.btree.pIndex;
129280 const char *z = explainIndexColumnName(pIndex, i);
129287 explainAppendTerm(pStr, pIndex, pLoop->u.btree.nBtm, j, i, ">");
129291 explainAppendTerm(pStr, pIndex, pLoop->u.btree.nTop, j, i, "<");
129352 assert( pLoop->u.btree.pIndex!=0 );
129353 pIdx = pLoop->u.btree.pIndex;
129425 if( (pLoop->wsFlags & WHERE_VIRTUALTABLE)==0 && pLoop->u.btree.pIndex!=0 ){
129426 zObj = pLoop->u.btree.pIndex->zName;
129705 && pLoop->u.btree.pIndex!=0
129706 && pLoop->u.btree.pIndex->aSortOrder[iEq]
129863 pIdx = pLoop->u.btree.pIndex;
130116 sHint.pIdx = pLoop->u.btree.pIndex;
130703 pIdx = pLoop->u.btree.pIndex;
131207 && (ii==0 || pSubLoop->u.btree.pIndex==pCov)
131208 && (HasRowid(pTab) || !IsPrimaryKeyIndex(pSubLoop->u.btree.pIndex))
131211 pCov = pSubLoop->u.btree.pIndex;
132302 for(pIdx=pFrom->a[i].pTab->pIndex; pIdx; pIdx=pIdx->pNext){
133421 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
133678 pLoop->u.btree.pIndex = pIdx;
134243 Index *p = pLoop->u.btree.pIndex;
134360 Index *p = pLoop->u.btree.pIndex;
134533 Index *p = pBuilder->pNew->u.btree.pIndex;
134597 Index *p = pBuilder->pNew->u.btree.pIndex;
134689 if( p->u.btree.pIndex && (zName = p->u.btree.pIndex->zName)!=0 ){
134745 }else if( (p->wsFlags & WHERE_AUTO_INDEX)!=0 && p->u.btree.pIndex!=0 ){
134746 sqlite3DbFree(db, p->u.btree.pIndex->zColAff);
134747 sqlite3DbFreeNN(db, p->u.btree.pIndex);
134748 p->u.btree.pIndex = 0;
134792 pFrom->u.btree.pIndex = 0;
135101 Index *pIndex = p->u.btree.pIndex;
135102 if( pIndex && pIndex->tnum==0 ){
135103 p->u.btree.pIndex = 0;
135600 Index *pIndex,
135607 if( pIndex->bUnordered ) return 0;
135613 for(jj=0; jj<pIndex->nKeyCol; jj++){
135614 if( pExpr->iColumn==pIndex->aiColumn[jj] ) return 1;
135616 }else if( (aColExpr = pIndex->aColExpr)!=0 ){
135617 for(jj=0; jj<pIndex->nKeyCol; jj++){
135618 if( pIndex->aiColumn[jj]!=XN_EXPR ) continue;
135737 pProbe = pTab->pIndex;
135754 pFirst = pSrc->pTab->pIndex;
135784 pNew->u.btree.pIndex = 0;
135836 pNew->u.btree.pIndex = pProbe;
136470 Index *pIndex; /* The index associated with pLoop */
136560 pIndex = 0;
136563 }else if( (pIndex = pLoop->u.btree.pIndex)==0 || pIndex->bUnordered ){
136566 nKeyCol = pIndex->nKeyCol;
136567 nColumn = pIndex->nColumn;
136568 assert( nColumn==nKeyCol+1 || !HasRowid(pIndex->pTable) );
136569 assert( pIndex->aiColumn[nColumn-1]==XN_ROWID
136570 || !HasRowid(pIndex->pTable));
136571 isOrderDistinct = IsUniqueIndex(pIndex);
136621 if( pIndex ){
136622 iColumn = pIndex->aiColumn[j];
136623 revIdx = pIndex->aSortOrder[j];
136624 if( iColumn==pIndex->pTable->iPKey ) iColumn = XN_ROWID;
136636 && pIndex->pTable->aCol[iColumn].notNull==0
136656 Expr *pIdxExpr = pIndex->aColExpr->a[j].pExpr;
136663 if( sqlite3StrICmp(pColl->zName, pIndex->azColl[j])!=0 ) continue;
137232 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
137253 pLoop->u.btree.pIndex = pIdx;
137807 if( pLoop->u.btree.pIndex!=0 ){
137822 Index *pIx = pLoop->u.btree.pIndex;
137835 Index *pJ = pTabItem->pTab->pIndex;
137955 && (pIdx = pLoop->u.btree.pIndex)->hasStat1
138004 VdbeComment((v, "next skip-scan on %s", pLoop->u.btree.pIndex->zName));
138077 pIdx = pLoop->u.btree.pIndex;
159762 struct Fts3Index *pIndex = &p->aIndex[i];
159763 if( nToken<pIndex->nPrefix ) continue;
159765 p, iCol, iPos, &pIndex->hPending, zToken, pIndex->nPrefix
190953 Fts5Index *pIndex;
191182 pNew->pIndex = 0;
191712 pExpr->pIndex, p->zTerm, (int)strlen(p->zTerm),
192284 p->pIndex = pIdx;
192662 pNew->pIndex = pExpr->pIndex;
194808 Fts5Index *pIndex; /* Index that owns this iterator */
197218 pNew->pIndex = p;
197479 assert( pIter->pIndex->pConfig->eDetail==FTS5_DETAIL_NONE );
197492 assert( pIter->pIndex->pConfig->eDetail!=FTS5_DETAIL_NONE );
197504 fts5SegiterPoslist(pIter->pIndex, pSeg, 0, &pIter->poslist);
197525 fts5SegiterPoslist(pIter->pIndex, pSeg, pIter->pColset, &pIter->poslist);
197543 assert( pIter->pIndex->pConfig->eDetail==FTS5_DETAIL_COLUMNS );
197585 assert( pIter->pIndex->pConfig->eDetail==FTS5_DETAIL_FULL );
197596 int *pRc = &pIter->pIndex->rc;
197607 fts5SegiterPoslist(pIter->pIndex, pSeg, pColset, &pIter->poslist);
197615 Fts5Config *pConfig = pIter->pIndex->pConfig;
199706 assert( pIter->pIndex->rc==SQLITE_OK );
199707 fts5MultiIterNext(pIter->pIndex, pIter, 0, 0);
199708 return fts5IndexReturn(pIter->pIndex);
199716 Fts5Index *p = pIter->pIndex;
199718 assert( pIter->pIndex->rc==SQLITE_OK );
199730 return fts5IndexReturn(pIter->pIndex);
199740 fts5MultiIterNextFrom(pIter->pIndex, pIter, iMatch);
199741 return fts5IndexReturn(pIter->pIndex);
199760 Fts5Index *pIndex = pIter->pIndex;
199762 fts5CloseReader(pIndex);
200915 Fts5Index *pIndex; /* Full-text index */
201114 sqlite3Fts5IndexClose(pTab->pIndex);
201180 rc = sqlite3Fts5IndexOpen(pConfig, bCreate, &pTab->pIndex, pzErr);
201186 pConfig, pTab->pIndex, bCreate, &pTab->pStorage, pzErr
201199 rc = sqlite3Fts5IndexLoadConfig(pTab->pIndex);
201200 sqlite3Fts5IndexRollback(pTab->pIndex);
201598 rc = sqlite3Fts5ExprFirst(pCsr->pExpr, pTab->pIndex, iRowid, bDesc);
201746 rc = sqlite3Fts5ExprFirst(pExpr, pTab->pIndex, pCsr->iFirstRowid, bDesc);
201776 pCsr->iSpecial = sqlite3Fts5IndexReads(pTab->pIndex);
202209 rc = sqlite3Fts5IndexLoadConfig(pTab->pIndex);
203036 return pTab->pIndex;
203564 Fts5Index *pIndex;
203820 Fts5Index *pIndex,
203837 p->pIndex = pIndex;
203918 Fts5Index *pIdx = pCtx->pStorage->pIndex;
203955 rc = sqlite3Fts5IndexBeginWrite(p->pIndex, 1, iDel);
204022 rc = sqlite3Fts5IndexGetAverages(p->pIndex, &p->nTotalRow, p->aTotalSize);
204047 rc = sqlite3Fts5IndexSetAverages(p->pIndex, buf.p, buf.n);
204119 rc = sqlite3Fts5IndexReinit(p->pIndex);
204149 rc = sqlite3Fts5IndexBeginWrite(p->pIndex, 0, iRowid);
204180 return sqlite3Fts5IndexOptimize(p->pIndex);
204184 return sqlite3Fts5IndexMerge(p->pIndex, nMerge);
204188 return sqlite3Fts5IndexReset(p->pIndex);
204271 rc = sqlite3Fts5IndexBeginWrite(p->pIndex, 0, iRowid);
204500 rc = sqlite3Fts5IndexIntegrityCheck(p->pIndex, ctx.cksum);
204636 rc = sqlite3Fts5IndexSync(p->pIndex);
204644 return sqlite3Fts5IndexRollback(p->pIndex);
204667 rc = sqlite3Fts5IndexSetCookie(p->pIndex, iNew);
206682 Fts5Index *pIndex; /* Associated FTS5 index */
206954 Fts5Index *pIndex = 0;
206974 pIndex = sqlite3Fts5IndexFromCsrid(pTab->pGlobal, iId, &pConfig);
206977 if( rc==SQLITE_OK && pIndex==0 ){
206994 pCsr->pIndex = pIndex;
207252 rc = sqlite3Fts5IndexQuery(pCsr->pIndex, zTerm, nTerm, f, 0, &pCsr->pIter);