/ Check-in [3e8ac469]
Login

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

Overview
Comment:Fix compiler warnings.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | nextgen-query-plan-exp
Files: files | file ages | folders
SHA1: 3e8ac46918c68723bd199dbec8b0901457d524a9
User & Date: drh 2013-06-15 15:11:45
Context
2013-06-17
14:18
Use automatic indices on subqueries of the FROM clause when appropriate. check-in: e8f12428 user: drh tags: nextgen-query-plan-exp
2013-06-15
15:11
Fix compiler warnings. check-in: 3e8ac469 user: drh tags: nextgen-query-plan-exp
2013-06-14
13:27
Comment tweaks in where.c. No changes to code. check-in: cecc5fdd user: drh tags: nextgen-query-plan-exp
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/select.c.

  1534   1534       v = sqlite3GetVdbe(pParse);
  1535   1535       if( NEVER(v==0) ) return;  /* VDBE should have already been allocated */
  1536   1536       if( sqlite3ExprIsInteger(p->pLimit, &n) ){
  1537   1537         sqlite3VdbeAddOp2(v, OP_Integer, n, iLimit);
  1538   1538         VdbeComment((v, "LIMIT counter"));
  1539   1539         if( n==0 ){
  1540   1540           sqlite3VdbeAddOp2(v, OP_Goto, 0, iBreak);
  1541         -      }else{
  1542         -        if( p->nSelectRow > n ) p->nSelectRow = n;
         1541  +      }else if( n>=0 && p->nSelectRow>(u64)n ){
         1542  +        p->nSelectRow = n;
  1543   1543         }
  1544   1544       }else{
  1545   1545         sqlite3ExprCode(pParse, p->pLimit, iLimit);
  1546   1546         sqlite3VdbeAddOp1(v, OP_MustBeInt, iLimit);
  1547   1547         VdbeComment((v, "LIMIT counter"));
  1548   1548         sqlite3VdbeAddOp2(v, OP_IfZero, iLimit, iBreak);
  1549   1549       }
................................................................................
  1729   1729         rc = sqlite3Select(pParse, p, &dest);
  1730   1730         testcase( rc!=SQLITE_OK );
  1731   1731         pDelete = p->pPrior;
  1732   1732         p->pPrior = pPrior;
  1733   1733         p->nSelectRow += pPrior->nSelectRow;
  1734   1734         if( pPrior->pLimit
  1735   1735          && sqlite3ExprIsInteger(pPrior->pLimit, &nLimit)
  1736         -       && p->nSelectRow > nLimit 
         1736  +       && nLimit>0 && p->nSelectRow > (u64)nLimit 
  1737   1737         ){
  1738   1738           p->nSelectRow = nLimit;
  1739   1739         }
  1740   1740         if( addr ){
  1741   1741           sqlite3VdbeJumpHere(v, addr);
  1742   1742         }
  1743   1743         break;

Changes to src/where.c.

  2923   2923   ** no conversion should be attempted before using a t2.b value as part of
  2924   2924   ** a key to search the index. Hence the first byte in the returned affinity
  2925   2925   ** string in this example would be set to SQLITE_AFF_NONE.
  2926   2926   */
  2927   2927   static int codeAllEqualityTerms(
  2928   2928     Parse *pParse,        /* Parsing context */
  2929   2929     WhereLevel *pLevel,   /* Which nested loop of the FROM we are coding */
  2930         -  WhereClause *pWC,     /* The WHERE clause */
  2931         -  Bitmask notReady,     /* Which parts of FROM have not yet been coded */
  2932   2930     int bRev,             /* Reverse the order of IN operators */
  2933   2931     int nExtraReg,        /* Number of extra registers to allocate */
  2934   2932     char **pzAff          /* OUT: Set to point to affinity string */
  2935   2933   ){
  2936   2934     int nEq;                      /* The number of == or IN constraints to code */
  2937   2935     Vdbe *v = pParse->pVdbe;      /* The vm under construction */
  2938   2936     Index *pIdx;                  /* The index being used for this loop */
................................................................................
  3471   3469         nExtraReg = 1;
  3472   3470       }
  3473   3471   
  3474   3472       /* Generate code to evaluate all constraint terms using == or IN
  3475   3473       ** and store the values of those terms in an array of registers
  3476   3474       ** starting at regBase.
  3477   3475       */
  3478         -    regBase = codeAllEqualityTerms(
  3479         -        pParse, pLevel, pWC, notReady, bRev, nExtraReg, &zStartAff
  3480         -    );
         3476  +    regBase = codeAllEqualityTerms(pParse,pLevel,bRev,nExtraReg,&zStartAff);
  3481   3477       zEndAff = sqlite3DbStrDup(pParse->db, zStartAff);
  3482   3478       addrNxt = pLevel->addrNxt;
  3483   3479   
  3484   3480       /* If we are doing a reverse order scan on an ascending index, or
  3485   3481       ** a forward order scan on a descending index, interchange the 
  3486   3482       ** start and end terms (pRangeStart and pRangeEnd).
  3487   3483       */
................................................................................
  4564   4560   
  4565   4561   #ifndef SQLITE_OMIT_VIRTUALTABLE
  4566   4562   /*
  4567   4563   ** Add all WhereLoop objects for a table of the join identified by
  4568   4564   ** pBuilder->pNew->iTab.  That table is guaranteed to be a virtual table.
  4569   4565   */
  4570   4566   static int whereLoopAddVirtual(
  4571         -  WhereLoopBuilder *pBuilder,  /* WHERE clause information */
  4572         -  Bitmask mExtra               /* Extra prerequesites for using this table */
         4567  +  WhereLoopBuilder *pBuilder   /* WHERE clause information */
  4573   4568   ){
  4574   4569     WhereInfo *pWInfo;           /* WHERE analysis context */
  4575   4570     Parse *pParse;               /* The parsing context */
  4576   4571     WhereClause *pWC;            /* The WHERE clause */
  4577   4572     struct SrcList_item *pSrc;   /* The FROM clause term to search */
  4578   4573     Table *pTab;
  4579   4574     sqlite3 *db;
................................................................................
  4775   4770             continue;
  4776   4771           }
  4777   4772           sBest.maskSelf = 0;
  4778   4773           sBest.rSetup = 0;
  4779   4774           sBest.rRun = 0;
  4780   4775   #ifndef SQLITE_OMIT_VIRTUALTABLE
  4781   4776           if( IsVirtual(pItem->pTab) ){
  4782         -          rc = whereLoopAddVirtual(&sSubBuild, mExtra);
         4777  +          rc = whereLoopAddVirtual(&sSubBuild);
  4783   4778           }else
  4784   4779   #endif
  4785   4780           {
  4786   4781             rc = whereLoopAddBtree(&sSubBuild, mExtra);
  4787   4782           }
  4788   4783           if( sBest.maskSelf==0 ) break;
  4789   4784           assert( sBest.rSetup==0 );
................................................................................
  4832   4827       pNew->iTab = iTab;
  4833   4828       pNew->maskSelf = getMask(&pWInfo->sMaskSet, pItem->iCursor);
  4834   4829       if( ((pItem->jointype|priorJoinType) & (JT_LEFT|JT_CROSS))!=0 ){
  4835   4830         mExtra = mPrior;
  4836   4831       }
  4837   4832       priorJoinType = pItem->jointype;
  4838   4833       if( IsVirtual(pItem->pTab) ){
  4839         -      rc = whereLoopAddVirtual(pBuilder, mExtra);
         4834  +      rc = whereLoopAddVirtual(pBuilder);
  4840   4835       }else{
  4841   4836         rc = whereLoopAddBtree(pBuilder, mExtra);
  4842   4837       }
  4843   4838       if( rc==SQLITE_OK ){
  4844   4839         rc = whereLoopAddOr(pBuilder, mExtra);
  4845   4840       }
  4846   4841       mPrior |= pNew->maskSelf;