Lines Matching refs:pIndex
14682 Index *pIndex; /* List of SQL indexes on this table. */ member
85916 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
93388 for(pIdx=pTab->pIndex; pIdx && eType==0; pIdx=pIdx->pNext){
96957 if( pNew->pIndex ){
98160 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
98558 Index *pIndex /* Handle extra flags for this index, if not NULL */
98588 assert( pIndex!=0 ); {
98590 if( pIndex ){
98592 pIndex->bUnordered = 0;
98593 pIndex->noSkipScan = 0;
98596 pIndex->bUnordered = 1;
98598 pIndex->szIdxRow = sqlite3LogEst(sqlite3Atoi(z+3));
98600 pIndex->noSkipScan = 1;
98604 pIndex->pTable->costMult = sqlite3LogEst(sqlite3Atoi(z+9));
98626 Index *pIndex;
98641 pIndex = 0;
98643 pIndex = sqlite3PrimaryKeyIndex(pTable);
98645 pIndex = sqlite3FindIndex(pInfo->db, argv[1], pInfo->zDatabase);
98649 if( pIndex ){
98651 int nCol = pIndex->nKeyCol+1;
98656 if( pIndex->aiRowEst==0 ){
98657 pIndex->aiRowEst = (tRowcnt*)sqlite3MallocZero(sizeof(tRowcnt) * nCol);
98658 if( pIndex->aiRowEst==0 ) sqlite3OomFault(pInfo->db);
98660 aiRowEst = pIndex->aiRowEst;
98662 pIndex->bUnordered = 0;
98663 decodeIntArray((char*)z, nCol, aiRowEst, pIndex->aiRowLogEst, pIndex);
98664 pIndex->hasStat1 = 1;
98665 if( pIndex->pPartIdxWhere==0 ){
98666 pTable->nRowLogEst = pIndex->aiRowLogEst[0];
100360 Index *pIndex;
100365 pIndex = sqlite3HashInsert(pHash, zIdxName, 0);
100366 if( ALWAYS(pIndex) ){
100367 if( pIndex->pTable->pIndex==pIndex ){
100368 pIndex->pTable->pIndex = pIndex->pNext;
100373 p = pIndex->pTable->pIndex;
100374 while( ALWAYS(p) && p->pNext!=pIndex ){ p = p->pNext; }
100375 if( ALWAYS(p && p->pNext==pIndex) ){
100376 p->pNext = pIndex->pNext;
100379 freeIndex(db, pIndex);
100500 Index *pIndex, *pNext;
100510 for(pIndex = pTable->pIndex; pIndex; pIndex=pNext){
100511 pNext = pIndex->pNext;
100512 assert( pIndex->pSchema==pTable->pSchema
100513 || (IsVirtual(pTable) && pIndex->idxType!=SQLITE_IDXTYPE_APPDEF) );
100515 char *zName = pIndex->zName;
100517 &pIndex->pSchema->idxHash, zName, 0
100519 assert( db==0 || sqlite3SchemaMutexHeld(db, 0, pIndex->pSchema) );
100520 assert( pOld==pIndex || pOld==0 );
100522 freeIndex(db, pIndex);
100709 for(p=pTab->pIndex; p && !IsPrimaryKeyIndex(p); p=p->pNext){}
101305 for(pIdx=p->pIndex; pIdx; pIdx=pIdx->pNext){
101670 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
101794 for(pIdx=p->pIndex; pIdx; pIdx=pIdx->pNext){
102260 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
102290 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
102665 static void sqlite3RefillIndex(Parse *pParse, Index *pIndex, int memRootPage){
102666 Table *pTab = pIndex->pTable; /* The table that is indexed */
102678 int iDb = sqlite3SchemaToIndex(db, pIndex->pSchema);
102681 if( sqlite3AuthCheck(pParse, SQLITE_REINDEX, pIndex->zName, 0,
102695 tnum = pIndex->tnum;
102697 pKey = sqlite3KeyInfoOfIndex(pParse, pIndex);
102702 sqlite3VdbeAddOp4(v, OP_SorterOpen, iSorter, 0, pIndex->nKeyCol, (char*)
102711 sqlite3GenerateIndexKey(pParse,pIndex,iTab,regRecord,0,&iPartIdxLabel,0,0);
102722 if( IsUniqueIndex(pIndex) ){
102727 pIndex->nKeyCol); VdbeCoverage(v);
102728 sqlite3UniqueConstraint(pParse, OE_Abort, pIndex);
102806 Index *pIndex = 0; /* The index to be created */
102946 for(pLoop=pTab->pIndex, n=1; pLoop; pLoop=pLoop->pNext, n++){}
103008 pIndex = sqlite3AllocateIndexObject(db, pList->nExpr + nExtraCol,
103013 assert( EIGHT_BYTE_ALIGNMENT(pIndex->aiRowLogEst) );
103014 assert( EIGHT_BYTE_ALIGNMENT(pIndex->azColl) );
103015 pIndex->zName = zExtra;
103017 memcpy(pIndex->zName, zName, nName+1);
103018 pIndex->pTable = pTab;
103019 pIndex->onError = (u8)onError;
103020 pIndex->uniqNotNull = onError!=OE_None;
103021 pIndex->idxType = idxType;
103022 pIndex->pSchema = db->aDb[iDb].pSchema;
103023 pIndex->nKeyCol = pList->nExpr;
103026 pIndex->pPartIdxWhere = pPIWhere;
103063 if( pIndex->aColExpr==0 ){
103065 pIndex->aColExpr = pCopy;
103072 pIndex->aiColumn[i] = XN_EXPR;
103073 pIndex->uniqNotNull = 0;
103080 pIndex->uniqNotNull = 0;
103082 pIndex->aiColumn[i] = (i16)j;
103101 pIndex->azColl[i] = zColl;
103103 pIndex->aSortOrder[i] = (u8)requestedSortOrder;
103114 if( hasColumn(pIndex->aiColumn, pIndex->nKeyCol, x) ){
103115 pIndex->nColumn--;
103117 pIndex->aiColumn[i] = x;
103118 pIndex->azColl[i] = pPk->azColl[j];
103119 pIndex->aSortOrder[i] = pPk->aSortOrder[j];
103123 assert( i==pIndex->nColumn );
103125 pIndex->aiColumn[i] = XN_ROWID;
103126 pIndex->azColl[i] = sqlite3StrBINARY;
103128 sqlite3DefaultRowEst(pIndex);
103129 if( pParse->pNewTable==0 ) estimateIndexWidth(pIndex);
103134 || pTab->iPKey<0 || sqlite3ColumnOfIndex(pIndex, pTab->iPKey)>=0 );
103135 if( pTblName!=0 && pIndex->nColumn>=pTab->nCol ){
103136 pIndex->isCovering = 1;
103139 if( sqlite3ColumnOfIndex(pIndex,j)>=0 ) continue;
103140 pIndex->isCovering = 0;
103168 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
103172 assert( IsUniqueIndex(pIndex) );
103174 if( pIdx->nKeyCol!=pIndex->nKeyCol ) continue;
103179 if( pIdx->aiColumn[k]!=pIndex->aiColumn[k] ) break;
103181 z2 = pIndex->azColl[k];
103185 if( pIdx->onError!=pIndex->onError ){
103193 if( !(pIdx->onError==OE_Default || pIndex->onError==OE_Default) ){
103198 pIdx->onError = pIndex->onError;
103214 assert( sqlite3SchemaMutexHeld(db, 0, pIndex->pSchema) );
103215 p = sqlite3HashInsert(&pIndex->pSchema->idxHash,
103216 pIndex->zName, pIndex);
103218 assert( p==pIndex ); /* Malloc must have failed */
103224 pIndex->tnum = db->init.newTnum;
103257 pIndex->tnum = sqlite3VdbeAddOp0(v, OP_Noop);
103280 pIndex->zName,
103291 sqlite3RefillIndex(pParse, pIndex, iMem);
103294 sqlite3MPrintf(db, "name='%q' AND type='index'", pIndex->zName));
103298 sqlite3VdbeJumpHere(v, pIndex->tnum);
103308 if( onError!=OE_Replace || pTab->pIndex==0
103309 || pTab->pIndex->onError==OE_Replace){
103310 pIndex->pNext = pTab->pIndex;
103311 pTab->pIndex = pIndex;
103313 Index *pOther = pTab->pIndex;
103317 pIndex->pNext = pOther->pNext;
103318 pOther->pNext = pIndex;
103320 pIndex = 0;
103325 if( pIndex ) freeIndex(db, pIndex);
103383 Index *pIndex;
103396 pIndex = sqlite3FindIndex(db, pName->a[0].zName, pName->a[0].zDatabase);
103397 if( pIndex==0 ){
103406 if( pIndex->idxType!=SQLITE_IDXTYPE_APPDEF ){
103411 iDb = sqlite3SchemaToIndex(db, pIndex->pSchema);
103415 Table *pTab = pIndex->pTable;
103422 if( sqlite3AuthCheck(pParse, code, pIndex->zName, pTab->zName, zDb) ){
103434 db->aDb[iDb].zDbSName, MASTER_NAME, pIndex->zName
103436 sqlite3ClearStatTables(pParse, iDb, "idx", pIndex->zName);
103438 destroyRootPage(pParse, pIndex->tnum, iDb);
103439 sqlite3VdbeAddOp4(v, OP_DropIndex, iDb, 0, 0, pIndex->zName, 0);
104121 static int collationMatch(const char *zColl, Index *pIndex){
104124 for(i=0; i<pIndex->nColumn; i++){
104125 const char *z = pIndex->azColl[i];
104126 assert( z!=0 || pIndex->aiColumn[i]<0 );
104127 if( pIndex->aiColumn[i]>=0 && 0==sqlite3StrICmp(z, zColl) ){
104141 Index *pIndex; /* An index associated with pTab */
104143 for(pIndex=pTab->pIndex; pIndex; pIndex=pIndex->pNext){
104144 if( zColl==0 || collationMatch(zColl, pIndex) ){
104147 sqlite3RefillIndex(pParse, pIndex, -1);
104196 Index *pIndex; /* An index associated with pTab */
104234 pIndex = sqlite3FindIndex(db, z, zDb);
104236 if( pIndex ){
104238 sqlite3RefillIndex(pParse, pIndex, -1);
105139 for(nIdx=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, nIdx++){
105211 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
105627 for(i=0, pIdx=pTab->pIndex; pIdx; i++, pIdx=pIdx->pNext){
107843 for(pIdx=pParent->pIndex; pIdx; pIdx=pIdx->pNext){
109215 Index *pIndex;
109220 for(pIndex=pTab->pIndex; pIndex; pIndex=pIndex->pNext){
109221 if( tnum==pIndex->tnum ){
109833 for(i=0, pIdx=pTab->pIndex; i<nIdx; pIdx=pIdx->pNext, i++){
110426 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
110493 if( pTab->pIndex ){
110521 for(ix=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, ix++){
110770 for(i=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, i++){
110881 for(i=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, i++){
111126 for(pDestIdx=pDest->pIndex; pDestIdx; pDestIdx=pDestIdx->pNext){
111130 for(pSrcIdx=pSrc->pIndex; pSrcIdx; pSrcIdx=pSrcIdx->pNext){
111176 (pDest->iPKey<0 && pDest->pIndex!=0) /* (1) */
111212 }else if( pDest->pIndex==0 ){
111236 for(pDestIdx=pDest->pIndex; pDestIdx; pDestIdx=pDestIdx->pNext){
111238 for(pSrcIdx=pSrc->pIndex; ALWAYS(pSrcIdx); pSrcIdx=pSrcIdx->pNext){
114562 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
114618 for(pIdx=pTab->pIndex, i=0; pIdx; pIdx=pIdx->pNext, i++){
114902 for(nIdx=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, nIdx++){ cnt++; }
114911 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
114945 && (pTab->pIndex==0 || isQuick)
114954 for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){
115002 for(j=0, pIdx=pTab->pIndex; pIdx && !isQuick; pIdx=pIdx->pNext, j++){
115052 for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){
115388 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
115980 Index *pIndex;
115981 pIndex = sqlite3FindIndex(db, argv[0], db->aDb[iDb].zDbSName);
115982 if( pIndex==0 ){
115989 }else if( sqlite3GetInt32(argv[1], &pIndex->tnum)==0 ){
120689 for(pIdx=pTab->pIndex;
122467 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
124102 for(nIdx=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, nIdx++){
124194 for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){
125485 assert( 0==pTable->pIndex );
125927 assert( pTab->pIndex==0 );
125931 pIdx = pNew->pIndex;
125934 pTab->pIndex = pIdx;
125935 pNew->pIndex = 0;
126541 Index *pIndex; /* Index used, or NULL */
127041 Index *pIndex = pLoop->u.btree.pIndex;
127049 const char *z = explainIndexColumnName(pIndex, i);
127056 explainAppendTerm(pStr, pIndex, pLoop->u.btree.nBtm, j, i, ">");
127060 explainAppendTerm(pStr, pIndex, pLoop->u.btree.nTop, j, i, "<");
127121 assert( pLoop->u.btree.pIndex!=0 );
127122 pIdx = pLoop->u.btree.pIndex;
127194 if( (pLoop->wsFlags & WHERE_VIRTUALTABLE)==0 && pLoop->u.btree.pIndex!=0 ){
127195 zObj = pLoop->u.btree.pIndex->zName;
127377 && pLoop->u.btree.pIndex!=0
127378 && pLoop->u.btree.pIndex->aSortOrder[iEq]
127580 pIdx = pLoop->u.btree.pIndex;
127833 sHint.pIdx = pLoop->u.btree.pIndex;
128420 pIdx = pLoop->u.btree.pIndex;
128923 && (ii==0 || pSubLoop->u.btree.pIndex==pCov)
128924 && (HasRowid(pTab) || !IsPrimaryKeyIndex(pSubLoop->u.btree.pIndex))
128927 pCov = pSubLoop->u.btree.pIndex;
129942 for(pIdx=pFrom->a[i].pTab->pIndex; pIdx; pIdx=pIdx->pNext){
131033 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
131281 pLoop->u.btree.pIndex = pIdx;
131836 Index *p = pLoop->u.btree.pIndex;
131953 Index *p = pLoop->u.btree.pIndex;
132126 Index *p = pBuilder->pNew->u.btree.pIndex;
132190 Index *p = pBuilder->pNew->u.btree.pIndex;
132282 if( p->u.btree.pIndex && (zName = p->u.btree.pIndex->zName)!=0 ){
132338 }else if( (p->wsFlags & WHERE_AUTO_INDEX)!=0 && p->u.btree.pIndex!=0 ){
132339 sqlite3DbFree(db, p->u.btree.pIndex->zColAff);
132340 sqlite3DbFreeNN(db, p->u.btree.pIndex);
132341 p->u.btree.pIndex = 0;
132385 pFrom->u.btree.pIndex = 0;
132687 Index *pIndex = p->u.btree.pIndex;
132688 if( pIndex && pIndex->tnum==0 ){
132689 p->u.btree.pIndex = 0;
133186 Index *pIndex,
133193 if( pIndex->bUnordered ) return 0;
133199 for(jj=0; jj<pIndex->nKeyCol; jj++){
133200 if( pExpr->iColumn==pIndex->aiColumn[jj] ) return 1;
133202 }else if( (aColExpr = pIndex->aColExpr)!=0 ){
133203 for(jj=0; jj<pIndex->nKeyCol; jj++){
133204 if( pIndex->aiColumn[jj]!=XN_EXPR ) continue;
133321 pProbe = pTab->pIndex;
133338 pFirst = pSrc->pTab->pIndex;
133368 pNew->u.btree.pIndex = 0;
133417 pNew->u.btree.pIndex = pProbe;
134034 Index *pIndex; /* The index associated with pLoop */
134128 pIndex = 0;
134131 }else if( (pIndex = pLoop->u.btree.pIndex)==0 || pIndex->bUnordered ){
134134 nKeyCol = pIndex->nKeyCol;
134135 nColumn = pIndex->nColumn;
134136 assert( nColumn==nKeyCol+1 || !HasRowid(pIndex->pTable) );
134137 assert( pIndex->aiColumn[nColumn-1]==XN_ROWID
134138 || !HasRowid(pIndex->pTable));
134139 isOrderDistinct = IsUniqueIndex(pIndex);
134189 if( pIndex ){
134190 iColumn = pIndex->aiColumn[j];
134191 revIdx = pIndex->aSortOrder[j];
134192 if( iColumn==pIndex->pTable->iPKey ) iColumn = -1;
134204 && pIndex->pTable->aCol[iColumn].notNull==0
134224 if( sqlite3ExprCompare(pOBExpr,pIndex->aColExpr->a[j].pExpr,iCur) ){
134231 if( sqlite3StrICmp(pColl->zName, pIndex->azColl[j])!=0 ) continue;
134789 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
134810 pLoop->u.btree.pIndex = pIdx;
135263 if( pLoop->u.btree.pIndex!=0 ){
135278 Index *pIx = pLoop->u.btree.pIndex;
135291 Index *pJ = pTabItem->pTab->pIndex;
135411 && (pIdx = pLoop->u.btree.pIndex)->hasStat1
135460 VdbeComment((v, "next skip-scan on %s", pLoop->u.btree.pIndex->zName));
135532 pIdx = pLoop->u.btree.pIndex;
156905 struct Fts3Index *pIndex = &p->aIndex[i];
156906 if( nToken<pIndex->nPrefix ) continue;
156908 p, iCol, iPos, &pIndex->hPending, zToken, pIndex->nPrefix
186817 Fts5Index *pIndex;
187044 pNew->pIndex = 0;
187569 pExpr->pIndex, p->zTerm, (int)strlen(p->zTerm),
188140 p->pIndex = pIdx;
188507 pNew->pIndex = pExpr->pIndex;
190643 Fts5Index *pIndex; /* Index that owns this iterator */
193051 pNew->pIndex = p;
193312 assert( pIter->pIndex->pConfig->eDetail==FTS5_DETAIL_NONE );
193325 assert( pIter->pIndex->pConfig->eDetail!=FTS5_DETAIL_NONE );
193337 fts5SegiterPoslist(pIter->pIndex, pSeg, 0, &pIter->poslist);
193358 fts5SegiterPoslist(pIter->pIndex, pSeg, pIter->pColset, &pIter->poslist);
193376 assert( pIter->pIndex->pConfig->eDetail==FTS5_DETAIL_COLUMNS );
193418 assert( pIter->pIndex->pConfig->eDetail==FTS5_DETAIL_FULL );
193429 int *pRc = &pIter->pIndex->rc;
193440 fts5SegiterPoslist(pIter->pIndex, pSeg, pColset, &pIter->poslist);
193448 Fts5Config *pConfig = pIter->pIndex->pConfig;
195532 assert( pIter->pIndex->rc==SQLITE_OK );
195533 fts5MultiIterNext(pIter->pIndex, pIter, 0, 0);
195534 return fts5IndexReturn(pIter->pIndex);
195542 Fts5Index *p = pIter->pIndex;
195544 assert( pIter->pIndex->rc==SQLITE_OK );
195556 return fts5IndexReturn(pIter->pIndex);
195566 fts5MultiIterNextFrom(pIter->pIndex, pIter, iMatch);
195567 return fts5IndexReturn(pIter->pIndex);
195586 Fts5Index *pIndex = pIter->pIndex;
195588 fts5CloseReader(pIndex);
196741 Fts5Index *pIndex; /* Full-text index */
196940 sqlite3Fts5IndexClose(pTab->pIndex);
197006 rc = sqlite3Fts5IndexOpen(pConfig, bCreate, &pTab->pIndex, pzErr);
197012 pConfig, pTab->pIndex, bCreate, &pTab->pStorage, pzErr
197025 rc = sqlite3Fts5IndexLoadConfig(pTab->pIndex);
197026 sqlite3Fts5IndexRollback(pTab->pIndex);
197424 rc = sqlite3Fts5ExprFirst(pCsr->pExpr, pTab->pIndex, iRowid, bDesc);
197571 rc = sqlite3Fts5ExprFirst(pExpr, pTab->pIndex, pCsr->iFirstRowid, bDesc);
197601 pCsr->iSpecial = sqlite3Fts5IndexReads(pTab->pIndex);
198033 rc = sqlite3Fts5IndexLoadConfig(pTab->pIndex);
198860 return pTab->pIndex;
199389 Fts5Index *pIndex;
199644 Fts5Index *pIndex,
199661 p->pIndex = pIndex;
199742 Fts5Index *pIdx = pCtx->pStorage->pIndex;
199779 rc = sqlite3Fts5IndexBeginWrite(p->pIndex, 1, iDel);
199846 rc = sqlite3Fts5IndexGetAverages(p->pIndex, &p->nTotalRow, p->aTotalSize);
199871 rc = sqlite3Fts5IndexSetAverages(p->pIndex, buf.p, buf.n);
199943 rc = sqlite3Fts5IndexReinit(p->pIndex);
199973 rc = sqlite3Fts5IndexBeginWrite(p->pIndex, 0, iRowid);
200004 return sqlite3Fts5IndexOptimize(p->pIndex);
200008 return sqlite3Fts5IndexMerge(p->pIndex, nMerge);
200012 return sqlite3Fts5IndexReset(p->pIndex);
200095 rc = sqlite3Fts5IndexBeginWrite(p->pIndex, 0, iRowid);
200324 rc = sqlite3Fts5IndexIntegrityCheck(p->pIndex, ctx.cksum);
200460 rc = sqlite3Fts5IndexSync(p->pIndex);
200468 return sqlite3Fts5IndexRollback(p->pIndex);
200491 rc = sqlite3Fts5IndexSetCookie(p->pIndex, iNew);
202501 Fts5Index *pIndex; /* Associated FTS5 index */
202754 Fts5Index *pIndex = 0;
202774 pIndex = sqlite3Fts5IndexFromCsrid(pTab->pGlobal, iId, &pConfig);
202777 if( rc==SQLITE_OK && pIndex==0 ){
202794 pCsr->pIndex = pIndex;
202998 rc = sqlite3Fts5IndexQuery(pCsr->pIndex, zTerm, nTerm, f, 0, &pCsr->pIter);