/ Check-in [23af28e2]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix problems in the virtual table logic for NGQP.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | nextgen-query-plan-exp
Files: files | file ages | folders
SHA1:23af28e24b8f7ffacd006978b25bab990a43b8c5
User & Date: drh 2013-05-31 17:55:27
Context
2013-05-31
18:13
Another virtual table fix in NGQP. check-in: 2f2ce416 user: drh tags: nextgen-query-plan-exp
17:55
Fix problems in the virtual table logic for NGQP. check-in: 23af28e2 user: drh tags: nextgen-query-plan-exp
15:50
Remove the definitions of objects that are no longer used: WhereCost, WherePlan, and WhereBestIdx. check-in: 816f8add user: drh tags: nextgen-query-plan-exp
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/where.c.

  3030   3030           codeEqualityTerm(pParse, pTerm, pLevel, j, bRev, iTarget);
  3031   3031           addrNotFound = pLevel->addrNxt;
  3032   3032         }else{
  3033   3033           sqlite3ExprCode(pParse, pTerm->pExpr->pRight, iTarget);
  3034   3034         }
  3035   3035       }
  3036   3036       sqlite3VdbeAddOp2(v, OP_Integer, pLoop->u.vtab.idxNum, iReg);
  3037         -    sqlite3VdbeAddOp2(v, OP_Integer, j-1, iReg+1);
         3037  +    sqlite3VdbeAddOp2(v, OP_Integer, nConstraint, iReg+1);
  3038   3038       sqlite3VdbeAddOp4(v, OP_VFilter, iCur, addrNotFound, iReg,
  3039   3039                         pLoop->u.vtab.idxStr,
  3040   3040                         pLoop->u.vtab.needFree ? P4_MPRINTF : P4_STATIC);
  3041   3041       pLoop->u.vtab.needFree = 0;
  3042   3042       for(j=0; j<nConstraint && j<16; j++){
  3043   3043         if( (pLoop->u.vtab.omitMask>>j)&1 ){
  3044   3044           disableTerm(pLevel, pLoop->aTerm[j]);
................................................................................
  5222   5222         sqlite3TableLock(pParse, iDb, pTab->tnum, 0, pTab->zName);
  5223   5223       }
  5224   5224   #ifndef SQLITE_OMIT_AUTOMATIC_INDEX
  5225   5225       if( (pLoop->wsFlags & WHERE_TEMP_INDEX)!=0 ){
  5226   5226         constructAutomaticIndex(pParse, pWInfo->pWC, pTabItem, notReady, pLevel);
  5227   5227       }else
  5228   5228   #endif
  5229         -    if( pLoop->u.btree.pIndex!=0 ){
         5229  +    if( pLoop->wsFlags & WHERE_INDEXED ){
  5230   5230         Index *pIx = pLoop->u.btree.pIndex;
  5231   5231         KeyInfo *pKey = sqlite3IndexKeyinfo(pParse, pIx);
  5232   5232         /* FIXME:  As an optimization use pTabItem->iCursor if WHERE_IDX_ONLY */
  5233   5233         int iIndexCur = pLevel->iIdxCur = iIdxCur ? iIdxCur : pParse->nTab++;
  5234   5234         assert( pIx->pSchema==pTab->pSchema );
  5235   5235         assert( iIndexCur>=0 );
  5236   5236         sqlite3VdbeAddOp4(v, OP_OpenRead, iIndexCur, pIx->tnum, iDb,