/ Check-in [9b2838f2]
Login

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

Overview
Comment:Clear the sort-order flags on the KeyInfo object associated with the OP_Compare/OP_Jump of the block-sort logic, in order to make the OP_Jump fully testable.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 9b2838f23e5f52369eeb078f60bd231cc54362f8
User & Date: drh 2014-03-22 02:19:53
Context
2014-03-23
16:29
Avoid a possible use of an uninitialized variable following an I/O or OOM error. check-in: 641408a1 user: drh tags: trunk
2014-03-22
02:19
Clear the sort-order flags on the KeyInfo object associated with the OP_Compare/OP_Jump of the block-sort logic, in order to make the OP_Jump fully testable. check-in: 9b2838f2 user: drh tags: trunk
01:52
Increase the version number to 3.8.5. check-in: 9760879d user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/select.c.

   477    477     sqlite3VdbeAddOp3(v, OP_MakeRecord, regBase+nOBSat, nExpr+2-nOBSat, regRecord);
   478    478     if( nOBSat>0 ){
   479    479       int regPrevKey;   /* The first nOBSat columns of the previous row */
   480    480       int addrFirst;    /* Address of the OP_IfNot opcode */
   481    481       int addrJmp;      /* Address of the OP_Jump opcode */
   482    482       VdbeOp *pOp;      /* Opcode that opens the sorter */
   483    483       int nKey;         /* Number of sorting key columns, including OP_Sequence */
          484  +    KeyInfo *pKI;     /* Original KeyInfo on the sorter table */
   484    485   
   485    486       regPrevKey = pParse->nMem+1;
   486    487       pParse->nMem += pSort->nOBSat;
   487    488       nKey = nExpr - pSort->nOBSat + 1;
   488    489       addrFirst = sqlite3VdbeAddOp1(v, OP_IfNot, regBase+nExpr); VdbeCoverage(v);
   489    490       sqlite3VdbeAddOp3(v, OP_Compare, regPrevKey, regBase, pSort->nOBSat);
   490    491       pOp = sqlite3VdbeGetOp(v, pSort->addrSortIndex);
   491    492       if( pParse->db->mallocFailed ) return;
   492    493       pOp->p2 = nKey + 1;
   493         -    sqlite3VdbeChangeP4(v, -1, (char*)pOp->p4.pKeyInfo, P4_KEYINFO);
          494  +    pKI = pOp->p4.pKeyInfo;
          495  +    memset(pKI->aSortOrder, 0, pKI->nField); /* Makes OP_Jump below testable */
          496  +    sqlite3VdbeChangeP4(v, -1, (char*)pKI, P4_KEYINFO);
   494    497       pOp->p4.pKeyInfo = keyInfoFromExprList(pParse, pSort->pOrderBy, nOBSat, 1);
   495    498       addrJmp = sqlite3VdbeCurrentAddr(v);
   496    499       sqlite3VdbeAddOp3(v, OP_Jump, addrJmp+1, 0, addrJmp+1); VdbeCoverage(v);
   497    500       pSort->labelBkOut = sqlite3VdbeMakeLabel(v);
   498    501       pSort->regReturn = ++pParse->nMem;
   499    502       sqlite3VdbeAddOp2(v, OP_Gosub, pSort->regReturn, pSort->labelBkOut);
   500    503       sqlite3VdbeAddOp1(v, OP_ResetSorter, pSort->iECursor);