Lines Matching refs:pIdx

73 const char *sqlite3IndexAffinityStr(sqlite3 *db, Index *pIdx){  in sqlite3IndexAffinityStr()  argument
74 if( !pIdx->zColAff ){ in sqlite3IndexAffinityStr()
84 Table *pTab = pIdx->pTable; in sqlite3IndexAffinityStr()
85 pIdx->zColAff = (char *)sqlite3DbMallocRaw(0, pIdx->nColumn+1); in sqlite3IndexAffinityStr()
86 if( !pIdx->zColAff ){ in sqlite3IndexAffinityStr()
90 for(n=0; n<pIdx->nColumn; n++){ in sqlite3IndexAffinityStr()
91 i16 x = pIdx->aiColumn[n]; in sqlite3IndexAffinityStr()
99 assert( pIdx->bHasExpr ); in sqlite3IndexAffinityStr()
100 assert( pIdx->aColExpr!=0 ); in sqlite3IndexAffinityStr()
101 aff = sqlite3ExprAffinity(pIdx->aColExpr->a[n].pExpr); in sqlite3IndexAffinityStr()
105 pIdx->zColAff[n] = aff; in sqlite3IndexAffinityStr()
107 pIdx->zColAff[n] = 0; in sqlite3IndexAffinityStr()
110 return pIdx->zColAff; in sqlite3IndexAffinityStr()
695 Index *pIdx; /* For looping over indices of the table */ in sqlite3Insert() local
1055 for(i=0, pIdx=pTab->pIndex; i<nIdx; pIdx=pIdx->pNext, i++){ in sqlite3Insert()
1056 assert( pIdx ); in sqlite3Insert()
1058 pParse->nMem += pIdx->nColumn; in sqlite3Insert()
1529 Index *pIdx; /* The current Index */ member
1554 return pIter->u.lx.pIdx; in indexIteratorFirst()
1570 pIter->u.lx.pIdx = pIter->u.lx.pIdx->pNext; in indexIteratorNext()
1571 return pIter->u.lx.pIdx; in indexIteratorNext()
1682 Index *pIdx; /* Pointer to one of the indices */ in sqlite3GenerateConstraintChecks() local
1907 sIdxIter.u.lx.pIdx = pTab->pIndex; in sqlite3GenerateConstraintChecks()
1929 for(nIdx=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, nIdx++){ in sqlite3GenerateConstraintChecks()
1943 pIdx = pTab->pIndex; in sqlite3GenerateConstraintChecks()
1944 while( ALWAYS(pIdx!=0) && pIdx!=pTerm->pUpsertIdx ){ in sqlite3GenerateConstraintChecks()
1945 pIdx = pIdx->pNext; in sqlite3GenerateConstraintChecks()
1950 sIdxIter.u.ax.aIdx[i].p = pIdx; in sqlite3GenerateConstraintChecks()
1954 for(jj=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, jj++){ in sqlite3GenerateConstraintChecks()
1956 sIdxIter.u.ax.aIdx[i].p = pIdx; in sqlite3GenerateConstraintChecks()
2159 for(pIdx = indexIteratorFirst(&sIdxIter, &ix); in sqlite3GenerateConstraintChecks()
2160 pIdx; in sqlite3GenerateConstraintChecks()
2161 pIdx = indexIteratorNext(&sIdxIter, &ix) in sqlite3GenerateConstraintChecks()
2171 pUpsertClause = sqlite3UpsertOfIndex(pUpsert, pIdx); in sqlite3GenerateConstraintChecks()
2181 VdbeNoopComment((v, "prep index %s", pIdx->zName)); in sqlite3GenerateConstraintChecks()
2186 if( pIdx->pPartIdxWhere ){ in sqlite3GenerateConstraintChecks()
2189 sqlite3ExprIfFalseDup(pParse, pIdx->pPartIdxWhere, addrUniqueOk, in sqlite3GenerateConstraintChecks()
2198 for(i=0; i<pIdx->nColumn; i++){ in sqlite3GenerateConstraintChecks()
2199 int iField = pIdx->aiColumn[i]; in sqlite3GenerateConstraintChecks()
2203 sqlite3ExprCodeCopy(pParse, pIdx->aColExpr->a[i].pExpr, regIdx+i); in sqlite3GenerateConstraintChecks()
2205 VdbeComment((v, "%s column %d", pIdx->zName, i)); in sqlite3GenerateConstraintChecks()
2217 sqlite3VdbeAddOp3(v, OP_MakeRecord, regIdx, pIdx->nColumn, aRegIdx[ix]); in sqlite3GenerateConstraintChecks()
2218 VdbeComment((v, "for %s", pIdx->zName)); in sqlite3GenerateConstraintChecks()
2220 if( pIdx->idxType==SQLITE_IDXTYPE_PRIMARYKEY ){ in sqlite3GenerateConstraintChecks()
2221 sqlite3SetMakeRecordP5(v, pIdx->pTable); in sqlite3GenerateConstraintChecks()
2224 sqlite3VdbeReleaseRegisters(pParse, regIdx, pIdx->nColumn, 0, 0); in sqlite3GenerateConstraintChecks()
2230 if( isUpdate && pPk==pIdx && pkChng==0 ){ in sqlite3GenerateConstraintChecks()
2236 onError = pIdx->onError; in sqlite3GenerateConstraintChecks()
2268 if( (ix==0 && pIdx->pNext==0) /* Condition 3 */ in sqlite3GenerateConstraintChecks()
2269 && pPk==pIdx /* Condition 2 */ in sqlite3GenerateConstraintChecks()
2285 regIdx, pIdx->nKeyCol); VdbeCoverage(v); in sqlite3GenerateConstraintChecks()
2288 regR = pIdx==pPk ? regIdx : sqlite3GetTempRange(pParse, nPkField); in sqlite3GenerateConstraintChecks()
2303 if( pIdx!=pPk ){ in sqlite3GenerateConstraintChecks()
2306 x = sqlite3TableColumnToIndex(pIdx, pPk->aiColumn[i]); in sqlite3GenerateConstraintChecks()
2322 int regCmp = (IsPrimaryKeyIndex(pIdx) ? regIdx : regR); in sqlite3GenerateConstraintChecks()
2354 sqlite3UniqueConstraint(pParse, onError, pIdx); in sqlite3GenerateConstraintChecks()
2359 sqlite3UpsertDoUpdate(pParse, pUpsert, pTab, pIdx, iIdxCur+ix); in sqlite3GenerateConstraintChecks()
2385 (pIdx==pPk ? ONEPASS_SINGLE : ONEPASS_OFF), iThisCur); in sqlite3GenerateConstraintChecks()
2401 if( pIdx->pPartIdxWhere ){ in sqlite3GenerateConstraintChecks()
2433 sqlite3UniqueConstraint(pParse, OE_Abort, pIdx); in sqlite3GenerateConstraintChecks()
2564 Index *pIdx; /* An index being inserted or updated */ in sqlite3CompleteInsertion() local
2576 for(i=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, i++){ in sqlite3CompleteInsertion()
2578 assert( pIdx->onError!=OE_Replace in sqlite3CompleteInsertion()
2579 || pIdx->pNext==0 in sqlite3CompleteInsertion()
2580 || pIdx->pNext->onError==OE_Replace ); in sqlite3CompleteInsertion()
2582 if( pIdx->pPartIdxWhere ){ in sqlite3CompleteInsertion()
2587 if( IsPrimaryKeyIndex(pIdx) && !HasRowid(pTab) ){ in sqlite3CompleteInsertion()
2596 pIdx->uniqNotNull ? pIdx->nKeyCol: pIdx->nColumn); in sqlite3CompleteInsertion()
2653 Index *pIdx; in sqlite3OpenTableAndIndices() local
2677 for(i=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, i++){ in sqlite3OpenTableAndIndices()
2679 assert( pIdx->pSchema==pTab->pSchema ); in sqlite3OpenTableAndIndices()
2680 if( IsPrimaryKeyIndex(pIdx) && !HasRowid(pTab) ){ in sqlite3OpenTableAndIndices()
2685 sqlite3VdbeAddOp3(v, op, iIdxCur, pIdx->tnum, iDb); in sqlite3OpenTableAndIndices()
2686 sqlite3VdbeSetP4KeyInfo(pParse, pIdx); in sqlite3OpenTableAndIndices()
2688 VdbeComment((v, "%s", pIdx->zName)); in sqlite3OpenTableAndIndices()