Lines Matching defs:pLevel
104524 ** and to set up the WhereLevel object pLevel so that the code generator
104532 WhereLevel *pLevel /* Write new index here */
104577 pLevel->plan.nEq = nColumn;
104597 pLevel->plan.wsFlags |= WHERE_COLUMN_EQ | WHERE_IDX_ONLY | WO_EQ;
104606 pLevel->plan.u.pIdx = pIdx;
104629 assert( (u32)n==pLevel->plan.nEq );
104651 assert( pLevel->iIdxCur>=0 );
104652 sqlite3VdbeAddOp4(v, OP_OpenAutoindex, pLevel->iIdxCur, nColumn+1, 0,
104657 addrTop = sqlite3VdbeAddOp1(v, OP_Rewind, pLevel->iTabCur);
104659 sqlite3GenerateIndexKey(pParse, pIdx, pLevel->iTabCur, regRecord, 1);
104660 sqlite3VdbeAddOp2(v, OP_IdxInsert, pLevel->iIdxCur, regRecord);
104662 sqlite3VdbeAddOp2(v, OP_Next, pLevel->iTabCur, addrTop+1);
105940 static void disableTerm(WhereLevel *pLevel, WhereTerm *pTerm){
105943 && (pLevel->iLeftJoin==0 || ExprHasProperty(pTerm->pExpr, EP_FromJoin))
105949 disableTerm(pLevel, pOther);
106009 WhereLevel *pLevel, /* When level of the FROM clause we are working on */
106033 assert( pLevel->plan.wsFlags & WHERE_IN_ABLE );
106034 if( pLevel->u.in.nIn==0 ){
106035 pLevel->addrNxt = sqlite3VdbeMakeLabel(v);
106037 pLevel->u.in.nIn++;
106038 pLevel->u.in.aInLoop =
106039 sqlite3DbReallocOrFree(pParse->db, pLevel->u.in.aInLoop,
106040 sizeof(pLevel->u.in.aInLoop[0])*pLevel->u.in.nIn);
106041 pIn = pLevel->u.in.aInLoop;
106043 pIn += pLevel->u.in.nIn - 1;
106052 pLevel->u.in.nIn = 0;
106056 disableTerm(pLevel, pTerm);
106074 ** The only thing it does is allocate the pLevel->iMem memory cell and
106101 WhereLevel *pLevel, /* Which nested loop of the FROM we are coding */
106107 int nEq = pLevel->plan.nEq; /* The number of == or IN constraints to code */
106110 int iCur = pLevel->iTabCur; /* The cursor of the table */
106118 assert( pLevel->plan.wsFlags & WHERE_INDEXED );
106119 pIdx = pLevel->plan.u.pIdx;
106124 nReg = pLevel->plan.nEq + nExtraReg;
106138 pTerm = findTerm(pWC, iCur, k, notReady, pLevel->plan.wsFlags, pIdx);
106144 r1 = codeEqualityTerm(pParse, pTerm, pLevel, regBase+j);
106157 sqlite3ExprCodeIsNullJump(v, pRight, regBase+j, pLevel->addrBrk);
106194 ** Argument pLevel describes a strategy for scanning table pTab. This
106212 static char *explainIndexRange(sqlite3 *db, WhereLevel *pLevel, Table *pTab){
106213 WherePlan *pPlan = &pLevel->plan;
106248 ** pLevel.
106253 WhereLevel *pLevel, /* Scan to write OP_Explain opcode for */
106259 u32 flags = pLevel->plan.wsFlags;
106260 struct SrcList_item *pItem = &pTabList->a[pLevel->iFrom];
106270 isSearch = (pLevel->plan.nEq>0)
106285 char *zWhere = explainIndexRange(db, pLevel, pItem->pTab);
106290 ((flags & WHERE_TEMP_INDEX)?"": pLevel->plan.u.pIdx->zName),
106309 sqlite3_index_info *pVtabIdx = pLevel->plan.u.pVtabIdx;
106318 nRow = (sqlite3_int64)pLevel->plan.nRow;
106344 WhereLevel *pLevel; /* The where level to be coded */
106358 pLevel = &pWInfo->a[iLevel];
106359 pTabItem = &pWInfo->pTabList->a[pLevel->iFrom];
106361 bRev = (pLevel->plan.wsFlags & WHERE_REVERSE)!=0;
106362 omitTable = (pLevel->plan.wsFlags & WHERE_IDX_ONLY)!=0
106375 addrBrk = pLevel->addrBrk = pLevel->addrNxt = sqlite3VdbeMakeLabel(v);
106376 addrCont = pLevel->addrCont = sqlite3VdbeMakeLabel(v);
106382 if( pLevel->iFrom>0 && (pTabItem[0].jointype & JT_LEFT)!=0 ){
106383 pLevel->iLeftJoin = ++pParse->nMem;
106384 sqlite3VdbeAddOp2(v, OP_Integer, 0, pLevel->iLeftJoin);
106389 if( (pLevel->plan.wsFlags & WHERE_VIRTUALTABLE)!=0 ){
106394 sqlite3_index_info *pVtabIdx = pLevel->plan.u.pVtabIdx;
106421 disableTerm(pLevel, &pWC->a[iTerm]);
106424 pLevel->op = OP_VNext;
106425 pLevel->p1 = iCur;
106426 pLevel->p2 = sqlite3VdbeCurrentAddr(v);
106432 if( pLevel->plan.wsFlags & WHERE_ROWID_EQ ){
106445 iRowidReg = codeEqualityTerm(pParse, pTerm, pLevel, iReleaseReg);
106446 addrNxt = pLevel->addrNxt;
106451 pLevel->op = OP_Noop;
106452 }else if( pLevel->plan.wsFlags & WHERE_ROWID_RANGE ){
106494 disableTerm(pLevel, pStart);
106511 disableTerm(pLevel, pEnd);
106514 pLevel->op = bRev ? OP_Prev : OP_Next;
106515 pLevel->p1 = iCur;
106516 pLevel->p2 = start;
106518 pLevel->p5 = SQLITE_STMTSTATUS_FULLSCAN_STEP;
106520 assert( pLevel->p5==0 );
106529 }else if( pLevel->plan.wsFlags & (WHERE_COLUMN_RANGE|WHERE_COLUMN_EQ) ){
106576 int nEq = pLevel->plan.nEq; /* Number of == or IN terms */
106593 pIdx = pLevel->plan.u.pIdx;
106594 iIdxCur = pLevel->iIdxCur;
106606 && (pLevel->plan.wsFlags&WHERE_ORDERBY)
106618 if( pLevel->plan.wsFlags & WHERE_TOP_LIMIT ){
106622 if( pLevel->plan.wsFlags & WHERE_BTM_LIMIT ){
106632 pParse, pLevel, pWC, notReady, nExtraReg, &zStartAff
106635 addrNxt = pLevel->addrNxt;
106723 pLevel->p2 = sqlite3VdbeCurrentAddr(v);
106740 testcase( pLevel->plan.wsFlags & WHERE_BTM_LIMIT );
106741 testcase( pLevel->plan.wsFlags & WHERE_TOP_LIMIT );
106742 if( (pLevel->plan.wsFlags & (WHERE_BTM_LIMIT|WHERE_TOP_LIMIT))!=0 ){
106749 disableTerm(pLevel, pRangeStart);
106750 disableTerm(pLevel, pRangeEnd);
106761 if( pLevel->plan.wsFlags & WHERE_UNIQUE ){
106762 pLevel->op = OP_Noop;
106764 pLevel->op = OP_Prev;
106766 pLevel->op = OP_Next;
106768 pLevel->p1 = iIdxCur;
106772 if( pLevel->plan.wsFlags & WHERE_MULTI_OR ){
106824 pTerm = pLevel->plan.u.pTerm;
106829 pLevel->op = OP_Return;
106830 pLevel->p1 = regReturn;
106848 memcpy(&pOrTab->a[k], &origSrc[pLevel[k].iFrom], sizeof(pOrTab->a[k]));
106912 pParse, pOrTab, &pSubWInfo->a[0], iLevel, pLevel->iFrom, 0
106941 sqlite3VdbeAddOp2(v, OP_Goto, 0, pLevel->addrBrk);
106945 if( !untestedTerms ) disableTerm(pLevel, pTerm);
106957 pLevel->op = aStep[bRev];
106958 pLevel->p1 = iCur;
106959 pLevel->p2 = 1 + sqlite3VdbeAddOp2(v, aStart[bRev], iCur, addrBrk);
106960 pLevel->p5 = SQLITE_STMTSTATUS_FULLSCAN_STEP;
106984 if( pLevel->iLeftJoin && !ExprHasProperty(pE, EP_FromJoin) ){
106994 if( pLevel->iLeftJoin ){
106995 pLevel->addrFirst = sqlite3VdbeCurrentAddr(v);
106996 sqlite3VdbeAddOp2(v, OP_Integer, 1, pLevel->iLeftJoin);
107164 WhereLevel *pLevel; /* A single level in the pWInfo list */
107311 for(i=iFrom=0, pLevel=pWInfo->a; i<nTabList; i++, pLevel++){
107459 bestJ, pLevel-pWInfo->a, bestPlan.rCost, bestPlan.plan.nRow));
107469 pLevel->plan = bestPlan.plan;
107473 pLevel->iIdxCur = pParse->nTab++;
107475 pLevel->iIdxCur = -1;
107478 pLevel->iFrom = (u8)bestJ;
107530 for(i=0, pLevel=pWInfo->a; i<nTabList; i++, pLevel++){
107534 pTabItem = &pTabList->a[pLevel->iFrom];
107536 pLevel->iTabCur = pTabItem->iCursor;
107537 pWInfo->nRowOut *= pLevel->plan.nRow;
107543 if( (pLevel->plan.wsFlags & WHERE_VIRTUALTABLE)!=0 ){
107549 if( (pLevel->plan.wsFlags & WHERE_IDX_ONLY)==0
107567 if( (pLevel->plan.wsFlags & WHERE_TEMP_INDEX)!=0 ){
107568 constructAutomaticIndex(pParse, pWC, pTabItem, notReady, pLevel);
107571 if( (pLevel->plan.wsFlags & WHERE_INDEXED)!=0 ){
107572 Index *pIx = pLevel->plan.u.pIdx;
107574 int iIdxCur = pLevel->iIdxCur;
107593 pLevel = &pWInfo->a[i];
107594 explainOneScan(pParse, pTabList, pLevel, i, pLevel->iFrom, wctrlFlags);
107596 pWInfo->iContinue = pLevel->addrCont;
107609 pLevel = &pWInfo->a[i];
107610 pTabItem = &pTabList->a[pLevel->iFrom];
107615 if( pLevel->plan.wsFlags & WHERE_IDX_ONLY ){
107624 testcase( pLevel->plan.wsFlags & WHERE_ROWID_EQ );
107625 testcase( pLevel->plan.wsFlags & WHERE_ROWID_RANGE );
107626 if( pLevel->plan.wsFlags & (WHERE_ROWID_EQ|WHERE_ROWID_RANGE) ){
107629 }else if( (pLevel->plan.wsFlags & WHERE_INDEXED)!=0 ){
107630 n = sqlite3Strlen30(pLevel->plan.u.pIdx->zName);
107632 memcpy(&sqlite3_query_plan[nQPlan], pLevel->plan.u.pIdx->zName, n);
107670 WhereLevel *pLevel;
107678 pLevel = &pWInfo->a[i];
107679 sqlite3VdbeResolveLabel(v, pLevel->addrCont);
107680 if( pLevel->op!=OP_Noop ){
107681 sqlite3VdbeAddOp2(v, pLevel->op, pLevel->p1, pLevel->p2);
107682 sqlite3VdbeChangeP5(v, pLevel->p5);
107684 if( pLevel->plan.wsFlags & WHERE_IN_ABLE && pLevel->u.in.nIn>0 ){
107687 sqlite3VdbeResolveLabel(v, pLevel->addrNxt);
107688 for(j=pLevel->u.in.nIn, pIn=&pLevel->u.in.aInLoop[j-1]; j>0; j--, pIn--){
107693 sqlite3DbFree(db, pLevel->u.in.aInLoop);
107695 sqlite3VdbeResolveLabel(v, pLevel->addrBrk);
107696 if( pLevel->iLeftJoin ){
107698 addr = sqlite3VdbeAddOp1(v, OP_IfPos, pLevel->iLeftJoin);
107699 assert( (pLevel->plan.wsFlags & WHERE_IDX_ONLY)==0
107700 || (pLevel->plan.wsFlags & WHERE_INDEXED)!=0 );
107701 if( (pLevel->plan.wsFlags & WHERE_IDX_ONLY)==0 ){
107704 if( pLevel->iIdxCur>=0 ){
107705 sqlite3VdbeAddOp1(v, OP_NullRow, pLevel->iIdxCur);
107707 if( pLevel->op==OP_Return ){
107708 sqlite3VdbeAddOp2(v, OP_Gosub, pLevel->p1, pLevel->addrFirst);
107710 sqlite3VdbeAddOp2(v, OP_Goto, 0, pLevel->addrFirst);
107724 for(i=0, pLevel=pWInfo->a; i<pWInfo->nLevel; i++, pLevel++){
107725 struct SrcList_item *pTabItem = &pTabList->a[pLevel->iFrom];
107732 int ws = pLevel->plan.wsFlags;
107737 sqlite3VdbeAddOp1(v, OP_Close, pLevel->iIdxCur);
107754 if( (pLevel->plan.wsFlags & WHERE_INDEXED)!=0 && !db->mallocFailed){
107757 Index *pIdx = pLevel->plan.u.pIdx;
107763 if( pOp->p1!=pLevel->iTabCur ) continue;
107768 pOp->p1 = pLevel->iIdxCur;
107772 assert( (pLevel->plan.wsFlags & WHERE_IDX_ONLY)==0
107775 pOp->p1 = pLevel->iIdxCur;