Lines Matching defs:pIndex
9402 Index *pIndex; /* List of SQL indexes on this table. */
9981 Index *pIndex; /* Index structure corresponding to zIndex, if any */
66735 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
69711 pNewItem->pIndex = pOldItem->pIndex;
70295 for(pIdx=pTab->pIndex; pIdx && eType==0 && affinity_ok; pIdx=pIdx->pNext){
73220 if( pNew->pIndex ){
73536 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
73556 ** first index in the pTab->pIndex list, then register regLast has
73558 if( pTab->pIndex==pIdx ){
73707 if( pTab->pIndex==0 ){
73869 Index *pIndex;
73886 pIndex = sqlite3FindIndex(pInfo->db, argv[1], pInfo->zDatabase);
73888 pIndex = 0;
73890 n = pIndex ? pIndex->nColumn : 0;
73899 if( pIndex==0 ) break;
73900 pIndex->aiRowEst[i] = v;
75220 Index *pIndex;
75225 pIndex = sqlite3HashInsert(pHash, zIdxName, len, 0);
75226 if( pIndex ){
75227 if( pIndex->pTable->pIndex==pIndex ){
75228 pIndex->pTable->pIndex = pIndex->pNext;
75233 p = pIndex->pTable->pIndex;
75234 while( ALWAYS(p) && p->pNext!=pIndex ){ p = p->pNext; }
75235 if( ALWAYS(p && p->pNext==pIndex) ){
75236 p->pNext = pIndex->pNext;
75239 freeIndex(db, pIndex);
75339 Index *pIndex, *pNext;
75348 for(pIndex = pTable->pIndex; pIndex; pIndex=pNext){
75349 pNext = pIndex->pNext;
75350 assert( pIndex->pSchema==pTable->pSchema );
75352 char *zName = pIndex->zName;
75354 &pIndex->pSchema->idxHash, zName, sqlite3Strlen30(zName), 0
75356 assert( pOld==pIndex || pOld==0 );
75358 freeIndex(db, pIndex);
76065 for(pIdx=p->pIndex; pIdx; pIdx=pIdx->pNext){
76753 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
76783 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
77121 ** the root page number of the index is taken from pIndex->tnum.
77123 static void sqlite3RefillIndex(Parse *pParse, Index *pIndex, int memRootPage){
77124 Table *pTab = pIndex->pTable; /* The table that is indexed */
77126 int iIdx = pParse->nTab++; /* Btree cursor used for pIndex */
77134 int iDb = sqlite3SchemaToIndex(db, pIndex->pSchema);
77137 if( sqlite3AuthCheck(pParse, SQLITE_REINDEX, pIndex->zName, 0,
77151 tnum = pIndex->tnum;
77154 pKey = sqlite3IndexKeyinfo(pParse, pIndex);
77163 regIdxKey = sqlite3GenerateIndexKey(pParse, pIndex, iTab, regRecord, 1);
77164 if( pIndex->onError!=OE_None ){
77165 const int regRowid = regIdxKey + pIndex->nColumn;
77195 ** UNIQUE constraint. If pTable and pIndex are NULL, use pParse->pNewTable
77221 Index *pIndex = 0; /* The index to be created */
77345 for(pLoop=pTab->pIndex, n=1; pLoop; pLoop=pLoop->pNext, n++){}
77401 pIndex = sqlite3DbMallocZero(db,
77413 pIndex->azColl = (char**)(&pIndex[1]);
77414 pIndex->aiColumn = (int *)(&pIndex->azColl[nCol]);
77415 pIndex->aiRowEst = (unsigned *)(&pIndex->aiColumn[nCol]);
77416 pIndex->aSortOrder = (u8 *)(&pIndex->aiRowEst[nCol+1]);
77417 pIndex->zName = (char *)(&pIndex->aSortOrder[nCol]);
77418 zExtra = (char *)(&pIndex->zName[nName+1]);
77419 memcpy(pIndex->zName, zName, nName+1);
77420 pIndex->pTable = pTab;
77421 pIndex->nColumn = pList->nExpr;
77422 pIndex->onError = (u8)onError;
77423 pIndex->autoIndex = (u8)(pName==0);
77424 pIndex->pSchema = db->aDb[iDb].pSchema;
77459 pIndex->aiColumn[i] = j;
77483 pIndex->azColl[i] = zColl;
77485 pIndex->aSortOrder[i] = (u8)requestedSortOrder;
77487 sqlite3DefaultRowEst(pIndex);
77512 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
77516 assert( pIndex->onError!=OE_None );
77518 if( pIdx->nColumn!=pIndex->nColumn ) continue;
77522 if( pIdx->aiColumn[k]!=pIndex->aiColumn[k] ) break;
77524 z2 = pIndex->azColl[k];
77528 if( pIdx->onError!=pIndex->onError ){
77536 if( !(pIdx->onError==OE_Default || pIndex->onError==OE_Default) ){
77541 pIdx->onError = pIndex->onError;
77554 p = sqlite3HashInsert(&pIndex->pSchema->idxHash,
77555 pIndex->zName, sqlite3Strlen30(pIndex->zName),
77556 pIndex);
77558 assert( p==pIndex ); /* Malloc must have failed */
77564 pIndex->tnum = db->init.newTnum;
77618 pIndex->zName,
77629 sqlite3RefillIndex(pParse, pIndex, iMem);
77632 sqlite3MPrintf(db, "name='%q' AND type='index'", pIndex->zName),
77645 if( onError!=OE_Replace || pTab->pIndex==0
77646 || pTab->pIndex->onError==OE_Replace){
77647 pIndex->pNext = pTab->pIndex;
77648 pIndex = pIndex;
77650 Index *pOther = pTab->pIndex;
77654 pIndex->pNext = pOther->pNext;
77655 pOther->pNext = pIndex;
77657 pRet = pIndex;
77658 pIndex = 0;
77663 if( pIndex ){
77664 sqlite3DbFree(db, pIndex->zColAff);
77665 sqlite3DbFree(db, pIndex);
77713 Index *pIndex;
77726 pIndex = sqlite3FindIndex(db, pName->a[0].zName, pName->a[0].zDatabase);
77727 if( pIndex==0 ){
77734 if( pIndex->autoIndex ){
77739 iDb = sqlite3SchemaToIndex(db, pIndex->pSchema);
77743 Table *pTab = pIndex->pTable;
77750 if( sqlite3AuthCheck(pParse, code, pIndex->zName, pTab->zName, zDb) ){
77763 pIndex->zName
77768 db->aDb[iDb].zName, pIndex->zName
77772 destroyRootPage(pParse, pIndex->tnum, iDb);
77773 sqlite3VdbeAddOp4(v, OP_DropIndex, iDb, 0, 0, pIndex->zName, 0);
78385 ** Check to see if pIndex uses the collating sequence pColl. Return
78389 static int collationMatch(const char *zColl, Index *pIndex){
78392 for(i=0; i<pIndex->nColumn; i++){
78393 const char *z = pIndex->azColl[i];
78409 Index *pIndex; /* An index associated with pTab */
78411 for(pIndex=pTab->pIndex; pIndex; pIndex=pIndex->pNext){
78412 if( zColl==0 || collationMatch(zColl, pIndex) ){
78415 sqlite3RefillIndex(pParse, pIndex, -1);
78463 Index *pIndex; /* An index associated with pTab */
78501 pIndex = sqlite3FindIndex(db, z, zDb);
78503 if( pIndex ){
78505 sqlite3RefillIndex(pParse, pIndex, -1);
79297 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
79353 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
79414 for(i=1, pIdx=pTab->pIndex; pIdx; i++, pIdx=pIdx->pNext){
79590 for(i=1, pIdx=pTab->pIndex; pIdx; i++, pIdx=pIdx->pNext){
81461 for(pIdx=pParent->pIndex; pIdx; pIdx=pIdx->pNext){
82576 Index *pIndex;
82581 for(pIndex=pTab->pIndex; pIndex; pIndex=pIndex->pNext){
82582 if( tnum==pIndex->tnum ){
83443 for(idx=1, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, idx++){
83718 }else if( pTab->pIndex ){
83741 for(iCur=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, iCur++){
83872 for(nIdx=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, nIdx++){}
83927 for(i=1, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, i++){
84149 for(pDestIdx=pDest->pIndex; pDestIdx; pDestIdx=pDestIdx->pNext){
84153 for(pSrcIdx=pSrc->pIndex; pSrcIdx; pSrcIdx=pSrcIdx->pNext){
84184 if( (pDest->iPKey<0 && pDest->pIndex!=0) || destHasUniqueIdx ){
84212 }else if( pDest->pIndex==0 ){
84223 for(pDestIdx=pDest->pIndex; pDestIdx; pDestIdx=pDestIdx->pNext){
84224 for(pSrcIdx=pSrc->pIndex; ALWAYS(pSrcIdx); pSrcIdx=pSrcIdx->pNext){
86408 pIdx = pTab->pIndex;
86597 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
86627 if( pTab->pIndex==0 ) continue;
86635 for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){
86662 for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){
87095 Index *pIndex;
87096 pIndex = sqlite3FindIndex(db, argv[0], db->aDb[iDb].zName);
87097 if( pIndex==0 ){
87104 }else if( sqlite3GetInt32(argv[1], &pIndex->tnum)==0 ){
90951 ** pFrom->pIndex and return SQLITE_OK.
90958 for(pIdx=pTab->pIndex;
90967 pFrom->pIndex = pIdx;
92056 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
93750 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
93811 for(nIdx=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, nIdx++){}
93816 for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){
93921 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
93928 for(i=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, i++){
94101 for(i=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, i++){
94862 assert( 0==pTable->pIndex );
97111 if( pSrc->notIndexed || pSrc->pIndex!=0 ){
97987 ** If there was an INDEXED BY clause (pSrc->pIndex) attached to the table in
98032 if( pSrc->pIndex ){
98034 pIdx = pProbe = pSrc->pIndex;
98049 pFirst = pSrc->pTab->pIndex;
98337 if( pSrc->pIndex ) break;
98355 assert( pSrc->pIndex==0
98357 || pCost->plan.u.pIdx==pSrc->pIndex
98700 Index *pIndex = pPlan->u.pIdx;
98704 int *aiColumn = pIndex->aiColumn;
99815 if( pTabItem->pIndex==0 ) nUnconstrained++;
99835 assert( pTabItem->pIndex==0
99837 || sCost.plan.u.pIdx==pTabItem->pIndex );
99866 && (nUnconstrained==0 || pTabItem->pIndex==0 /* (3) */
99909 pIdx = pTabList->a[bestJ].pIndex;