Lines Matching refs:pLevel
100135 WhereLevel *pLevel /* Write new index here */
100183 pLevel->plan.nEq = nColumn;
100203 pLevel->plan.wsFlags |= WHERE_COLUMN_EQ | WHERE_IDX_ONLY | WO_EQ;
100212 pLevel->plan.u.pIdx = pIdx;
100235 assert( (u32)n==pLevel->plan.nEq );
100257 assert( pLevel->iIdxCur>=0 );
100258 sqlite3VdbeAddOp4(v, OP_OpenAutoindex, pLevel->iIdxCur, nColumn+1, 0,
100263 addrTop = sqlite3VdbeAddOp1(v, OP_Rewind, pLevel->iTabCur);
100265 sqlite3GenerateIndexKey(pParse, pIdx, pLevel->iTabCur, regRecord, 1);
100266 sqlite3VdbeAddOp2(v, OP_IdxInsert, pLevel->iIdxCur, regRecord);
100268 sqlite3VdbeAddOp2(v, OP_Next, pLevel->iTabCur, addrTop+1);
101530 static void disableTerm(WhereLevel *pLevel, WhereTerm *pTerm){
101533 && (pLevel->iLeftJoin==0 || ExprHasProperty(pTerm->pExpr, EP_FromJoin))
101539 disableTerm(pLevel, pOther);
101599 WhereLevel *pLevel, /* When level of the FROM clause we are working on */
101623 assert( pLevel->plan.wsFlags & WHERE_IN_ABLE );
101624 if( pLevel->u.in.nIn==0 ){
101625 pLevel->addrNxt = sqlite3VdbeMakeLabel(v);
101627 pLevel->u.in.nIn++;
101628 pLevel->u.in.aInLoop =
101629 sqlite3DbReallocOrFree(pParse->db, pLevel->u.in.aInLoop,
101630 sizeof(pLevel->u.in.aInLoop[0])*pLevel->u.in.nIn);
101631 pIn = pLevel->u.in.aInLoop;
101633 pIn += pLevel->u.in.nIn - 1;
101642 pLevel->u.in.nIn = 0;
101646 disableTerm(pLevel, pTerm);
101691 WhereLevel *pLevel, /* Which nested loop of the FROM we are coding */
101697 int nEq = pLevel->plan.nEq; /* The number of == or IN constraints to code */
101700 int iCur = pLevel->iTabCur; /* The cursor of the table */
101708 assert( pLevel->plan.wsFlags & WHERE_INDEXED );
101709 pIdx = pLevel->plan.u.pIdx;
101714 nReg = pLevel->plan.nEq + nExtraReg;
101728 pTerm = findTerm(pWC, iCur, k, notReady, pLevel->plan.wsFlags, pIdx);
101734 r1 = codeEqualityTerm(pParse, pTerm, pLevel, regBase+j);
101747 sqlite3ExprCodeIsNullJump(v, pRight, regBase+j, pLevel->addrBrk);
101802 static char *explainIndexRange(sqlite3 *db, WhereLevel *pLevel, Table *pTab){
101803 WherePlan *pPlan = &pLevel->plan;
101841 WhereLevel *pLevel, /* Scan to write OP_Explain opcode for */
101847 u32 flags = pLevel->plan.wsFlags;
101848 struct SrcList_item *pItem = &pTabList->a[pLevel->iFrom];
101858 isSearch = (pLevel->plan.nEq>0)
101873 char *zWhere = explainIndexRange(db, pLevel, pItem->pTab);
101878 ((flags & WHERE_TEMP_INDEX)?"": pLevel->plan.u.pIdx->zName),
101897 sqlite3_index_info *pVtabIdx = pLevel->plan.u.pVtabIdx;
101906 nRow = (sqlite3_int64)pLevel->plan.nRow;
101932 WhereLevel *pLevel; /* The where level to be coded */
101946 pLevel = &pWInfo->a[iLevel];
101947 pTabItem = &pWInfo->pTabList->a[pLevel->iFrom];
101949 bRev = (pLevel->plan.wsFlags & WHERE_REVERSE)!=0;
101950 omitTable = (pLevel->plan.wsFlags & WHERE_IDX_ONLY)!=0
101963 addrBrk = pLevel->addrBrk = pLevel->addrNxt = sqlite3VdbeMakeLabel(v);
101964 addrCont = pLevel->addrCont = sqlite3VdbeMakeLabel(v);
101970 if( pLevel->iFrom>0 && (pTabItem[0].jointype & JT_LEFT)!=0 ){
101971 pLevel->iLeftJoin = ++pParse->nMem;
101972 sqlite3VdbeAddOp2(v, OP_Integer, 0, pLevel->iLeftJoin);
101977 if( (pLevel->plan.wsFlags & WHERE_VIRTUALTABLE)!=0 ){
101982 sqlite3_index_info *pVtabIdx = pLevel->plan.u.pVtabIdx;
102009 disableTerm(pLevel, &pWC->a[iTerm]);
102012 pLevel->op = OP_VNext;
102013 pLevel->p1 = iCur;
102014 pLevel->p2 = sqlite3VdbeCurrentAddr(v);
102020 if( pLevel->plan.wsFlags & WHERE_ROWID_EQ ){
102033 iRowidReg = codeEqualityTerm(pParse, pTerm, pLevel, iReleaseReg);
102034 addrNxt = pLevel->addrNxt;
102039 pLevel->op = OP_Noop;
102040 }else if( pLevel->plan.wsFlags & WHERE_ROWID_RANGE ){
102082 disableTerm(pLevel, pStart);
102099 disableTerm(pLevel, pEnd);
102102 pLevel->op = bRev ? OP_Prev : OP_Next;
102103 pLevel->p1 = iCur;
102104 pLevel->p2 = start;
102106 pLevel->p5 = SQLITE_STMTSTATUS_FULLSCAN_STEP;
102108 assert( pLevel->p5==0 );
102117 }else if( pLevel->plan.wsFlags & (WHERE_COLUMN_RANGE|WHERE_COLUMN_EQ) ){
102164 int nEq = pLevel->plan.nEq; /* Number of == or IN terms */
102181 pIdx = pLevel->plan.u.pIdx;
102182 iIdxCur = pLevel->iIdxCur;
102194 && (pLevel->plan.wsFlags&WHERE_ORDERBY)
102206 if( pLevel->plan.wsFlags & WHERE_TOP_LIMIT ){
102210 if( pLevel->plan.wsFlags & WHERE_BTM_LIMIT ){
102220 pParse, pLevel, pWC, notReady, nExtraReg, &zStartAff
102223 addrNxt = pLevel->addrNxt;
102309 pLevel->p2 = sqlite3VdbeCurrentAddr(v);
102326 testcase( pLevel->plan.wsFlags & WHERE_BTM_LIMIT );
102327 testcase( pLevel->plan.wsFlags & WHERE_TOP_LIMIT );
102328 if( (pLevel->plan.wsFlags & (WHERE_BTM_LIMIT|WHERE_TOP_LIMIT))!=0 ){
102335 disableTerm(pLevel, pRangeStart);
102336 disableTerm(pLevel, pRangeEnd);
102347 if( pLevel->plan.wsFlags & WHERE_UNIQUE ){
102348 pLevel->op = OP_Noop;
102350 pLevel->op = OP_Prev;
102352 pLevel->op = OP_Next;
102354 pLevel->p1 = iIdxCur;
102358 if( pLevel->plan.wsFlags & WHERE_MULTI_OR ){
102409 pTerm = pLevel->plan.u.pTerm;
102414 pLevel->op = OP_Return;
102415 pLevel->p1 = regReturn;
102433 memcpy(&pOrTab->a[k], &origSrc[pLevel[k].iFrom], sizeof(pOrTab->a[k]));
102467 pParse, pOrTab, &pSubWInfo->a[0], iLevel, pLevel->iFrom, 0
102492 sqlite3VdbeAddOp2(v, OP_Goto, 0, pLevel->addrBrk);
102496 if( !untestedTerms ) disableTerm(pLevel, pTerm);
102508 pLevel->op = aStep[bRev];
102509 pLevel->p1 = iCur;
102510 pLevel->p2 = 1 + sqlite3VdbeAddOp2(v, aStart[bRev], iCur, addrBrk);
102511 pLevel->p5 = SQLITE_STMTSTATUS_FULLSCAN_STEP;
102535 if( pLevel->iLeftJoin && !ExprHasProperty(pE, EP_FromJoin) ){
102545 if( pLevel->iLeftJoin ){
102546 pLevel->addrFirst = sqlite3VdbeCurrentAddr(v);
102547 sqlite3VdbeAddOp2(v, OP_Integer, 1, pLevel->iLeftJoin);
102714 WhereLevel *pLevel; /* A single level in the pWInfo list */
102848 for(i=iFrom=0, pLevel=pWInfo->a; i<nTabList; i++, pLevel++){
102994 bestJ, pLevel-pWInfo->a, bestPlan.rCost, bestPlan.plan.nRow));
102999 pLevel->plan = bestPlan.plan;
103003 pLevel->iIdxCur = pParse->nTab++;
103005 pLevel->iIdxCur = -1;
103008 pLevel->iFrom = (u8)bestJ;
103060 for(i=0, pLevel=pWInfo->a; i<nTabList; i++, pLevel++){
103064 pTabItem = &pTabList->a[pLevel->iFrom];
103066 pLevel->iTabCur = pTabItem->iCursor;
103067 pWInfo->nRowOut *= pLevel->plan.nRow;
103073 if( (pLevel->plan.wsFlags & WHERE_VIRTUALTABLE)!=0 ){
103079 if( (pLevel->plan.wsFlags & WHERE_IDX_ONLY)==0
103097 if( (pLevel->plan.wsFlags & WHERE_TEMP_INDEX)!=0 ){
103098 constructAutomaticIndex(pParse, pWC, pTabItem, notReady, pLevel);
103101 if( (pLevel->plan.wsFlags & WHERE_INDEXED)!=0 ){
103102 Index *pIx = pLevel->plan.u.pIdx;
103104 int iIdxCur = pLevel->iIdxCur;
103123 pLevel = &pWInfo->a[i];
103124 explainOneScan(pParse, pTabList, pLevel, i, pLevel->iFrom, wctrlFlags);
103126 pWInfo->iContinue = pLevel->addrCont;
103139 pLevel = &pWInfo->a[i];
103140 pTabItem = &pTabList->a[pLevel->iFrom];
103145 if( pLevel->plan.wsFlags & WHERE_IDX_ONLY ){
103154 testcase( pLevel->plan.wsFlags & WHERE_ROWID_EQ );
103155 testcase( pLevel->plan.wsFlags & WHERE_ROWID_RANGE );
103156 if( pLevel->plan.wsFlags & (WHERE_ROWID_EQ|WHERE_ROWID_RANGE) ){
103159 }else if( (pLevel->plan.wsFlags & WHERE_INDEXED)!=0 ){
103160 n = sqlite3Strlen30(pLevel->plan.u.pIdx->zName);
103162 memcpy(&sqlite3_query_plan[nQPlan], pLevel->plan.u.pIdx->zName, n);
103200 WhereLevel *pLevel;
103208 pLevel = &pWInfo->a[i];
103209 sqlite3VdbeResolveLabel(v, pLevel->addrCont);
103210 if( pLevel->op!=OP_Noop ){
103211 sqlite3VdbeAddOp2(v, pLevel->op, pLevel->p1, pLevel->p2);
103212 sqlite3VdbeChangeP5(v, pLevel->p5);
103214 if( pLevel->plan.wsFlags & WHERE_IN_ABLE && pLevel->u.in.nIn>0 ){
103217 sqlite3VdbeResolveLabel(v, pLevel->addrNxt);
103218 for(j=pLevel->u.in.nIn, pIn=&pLevel->u.in.aInLoop[j-1]; j>0; j--, pIn--){
103223 sqlite3DbFree(db, pLevel->u.in.aInLoop);
103225 sqlite3VdbeResolveLabel(v, pLevel->addrBrk);
103226 if( pLevel->iLeftJoin ){
103228 addr = sqlite3VdbeAddOp1(v, OP_IfPos, pLevel->iLeftJoin);
103229 assert( (pLevel->plan.wsFlags & WHERE_IDX_ONLY)==0
103230 || (pLevel->plan.wsFlags & WHERE_INDEXED)!=0 );
103231 if( (pLevel->plan.wsFlags & WHERE_IDX_ONLY)==0 ){
103234 if( pLevel->iIdxCur>=0 ){
103235 sqlite3VdbeAddOp1(v, OP_NullRow, pLevel->iIdxCur);
103237 if( pLevel->op==OP_Return ){
103238 sqlite3VdbeAddOp2(v, OP_Gosub, pLevel->p1, pLevel->addrFirst);
103240 sqlite3VdbeAddOp2(v, OP_Goto, 0, pLevel->addrFirst);
103254 for(i=0, pLevel=pWInfo->a; i<pWInfo->nLevel; i++, pLevel++){
103255 struct SrcList_item *pTabItem = &pTabList->a[pLevel->iFrom];
103262 int ws = pLevel->plan.wsFlags;
103267 sqlite3VdbeAddOp1(v, OP_Close, pLevel->iIdxCur);
103284 if( (pLevel->plan.wsFlags & WHERE_INDEXED)!=0 && !db->mallocFailed){
103287 Index *pIdx = pLevel->plan.u.pIdx;
103293 if( pOp->p1!=pLevel->iTabCur ) continue;
103298 pOp->p1 = pLevel->iIdxCur;
103302 assert( (pLevel->plan.wsFlags & WHERE_IDX_ONLY)==0
103305 pOp->p1 = pLevel->iIdxCur;