/ Check-in [d3531f5b]
Login

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

Overview
Comment:Add additional VDBE coverage macros.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | nulls-last
Files: files | file ages | folders
SHA3-256: d3531f5be7d3769689e2cd8bdc9bab5608759de027d44cc123996f32a4a89583
User & Date: drh 2019-08-22 21:13:56
Original Comment: Add additional VDBE coverage marcros.
Context
2019-08-23
13:08
Extra VDBE comments in the NULLS LAST logic provide landmarks to help understand the EXPLAIN output. check-in: 649b08ea user: drh tags: nulls-last
2019-08-22
21:13
Add additional VDBE coverage macros. check-in: d3531f5b user: drh tags: nulls-last
19:35
Merge fixes from trunk. Also fix a reference to the KeyInfo.aSortOrder field, which should now be KeyInfo.aSortFlags check-in: 63e625c8 user: drh tags: nulls-last
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/wherecode.c.

1706
1707
1708
1709
1710
1711
1712







1713
1714
1715







1716
1717
1718
1719
1720
1721
1722
....
1758
1759
1760
1761
1762
1763
1764

1765
1766
1767
1768
1769
1770
1771
1772
1773
1774

1775
1776

1777


1778
1779
1780




1781
1782
1783
1784
1785
1786
1787

      if( regBignull ){
        sqlite3VdbeAddOp2(v, OP_Goto, 0, sqlite3VdbeCurrentAddr(v)+2);
        if( bStopAtNull ){
          start_constraints = (nConstraint>1);
          op = aStartOp[(start_constraints<<2) + (startEq<<1) + bRev];
          sqlite3VdbeAddOp4Int(v, op, iIdxCur, addrNxt, regBase, nConstraint-1);







        }else{
          op = aStartOp[(start_constraints<<2) + ((!startEq)<<1) + bRev];
          sqlite3VdbeAddOp4Int(v, op, iIdxCur, addrNxt, regBase, nConstraint);







        }
      }
    }

    /* Load the value for the inequality constraint at the end of the
    ** range (if any).
    */
................................................................................
    /* Top of the loop body */
    pLevel->p2 = sqlite3VdbeCurrentAddr(v);

    /* Check if the index cursor is past the end of the range. */
    if( nConstraint ){
      if( regBignull ){
        sqlite3VdbeAddOp2(v, OP_If, regBignull, sqlite3VdbeCurrentAddr(v)+3);

      }
      op = aEndOp[bRev*2 + endEq];
      sqlite3VdbeAddOp4Int(v, op, iIdxCur, addrNxt, regBase, nConstraint);
      testcase( op==OP_IdxGT );  VdbeCoverageIf(v, op==OP_IdxGT );
      testcase( op==OP_IdxGE );  VdbeCoverageIf(v, op==OP_IdxGE );
      testcase( op==OP_IdxLT );  VdbeCoverageIf(v, op==OP_IdxLT );
      testcase( op==OP_IdxLE );  VdbeCoverageIf(v, op==OP_IdxLE );
    }
    if( regBignull ){
      sqlite3VdbeAddOp2(v, OP_IfNot, regBignull, sqlite3VdbeCurrentAddr(v)+2);

      if( bStopAtNull ){
        op = aEndOp[bRev*2 + 0];

        sqlite3VdbeAddOp4Int(v, op, iIdxCur, addrNxt, regBase, nConstraint);


      }else{
        op = aEndOp[bRev*2 + endEq];
        sqlite3VdbeAddOp4Int(v, op, iIdxCur, addrNxt, regBase, nConstraint+1);




      }
    }

    if( pLoop->wsFlags & WHERE_IN_EARLYOUT ){
      sqlite3VdbeAddOp2(v, OP_SeekHit, iIdxCur, 1);
    }








>
>
>
>
>
>
>



>
>
>
>
>
>
>







 







>










>


>

>
>



>
>
>
>







1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
....
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810

      if( regBignull ){
        sqlite3VdbeAddOp2(v, OP_Goto, 0, sqlite3VdbeCurrentAddr(v)+2);
        if( bStopAtNull ){
          start_constraints = (nConstraint>1);
          op = aStartOp[(start_constraints<<2) + (startEq<<1) + bRev];
          sqlite3VdbeAddOp4Int(v, op, iIdxCur, addrNxt, regBase, nConstraint-1);
          VdbeCoverage(v);
          VdbeCoverageIf(v, op==OP_Rewind);  testcase( op==OP_Rewind );
          VdbeCoverageIf(v, op==OP_Last);    testcase( op==OP_Last );
          VdbeCoverageIf(v, op==OP_SeekGT);  testcase( op==OP_SeekGT );
          VdbeCoverageIf(v, op==OP_SeekGE);  testcase( op==OP_SeekGE );
          VdbeCoverageIf(v, op==OP_SeekLE);  testcase( op==OP_SeekLE );
          VdbeCoverageIf(v, op==OP_SeekLT);  testcase( op==OP_SeekLT );
        }else{
          op = aStartOp[(start_constraints<<2) + ((!startEq)<<1) + bRev];
          sqlite3VdbeAddOp4Int(v, op, iIdxCur, addrNxt, regBase, nConstraint);
          VdbeCoverage(v);
          VdbeCoverageIf(v, op==OP_Rewind);  testcase( op==OP_Rewind );
          VdbeCoverageIf(v, op==OP_Last);    testcase( op==OP_Last );
          VdbeCoverageIf(v, op==OP_SeekGT);  testcase( op==OP_SeekGT );
          VdbeCoverageIf(v, op==OP_SeekGE);  testcase( op==OP_SeekGE );
          VdbeCoverageIf(v, op==OP_SeekLE);  testcase( op==OP_SeekLE );
          VdbeCoverageIf(v, op==OP_SeekLT);  testcase( op==OP_SeekLT );
        }
      }
    }

    /* Load the value for the inequality constraint at the end of the
    ** range (if any).
    */
................................................................................
    /* Top of the loop body */
    pLevel->p2 = sqlite3VdbeCurrentAddr(v);

    /* Check if the index cursor is past the end of the range. */
    if( nConstraint ){
      if( regBignull ){
        sqlite3VdbeAddOp2(v, OP_If, regBignull, sqlite3VdbeCurrentAddr(v)+3);
        VdbeCoverage(v);
      }
      op = aEndOp[bRev*2 + endEq];
      sqlite3VdbeAddOp4Int(v, op, iIdxCur, addrNxt, regBase, nConstraint);
      testcase( op==OP_IdxGT );  VdbeCoverageIf(v, op==OP_IdxGT );
      testcase( op==OP_IdxGE );  VdbeCoverageIf(v, op==OP_IdxGE );
      testcase( op==OP_IdxLT );  VdbeCoverageIf(v, op==OP_IdxLT );
      testcase( op==OP_IdxLE );  VdbeCoverageIf(v, op==OP_IdxLE );
    }
    if( regBignull ){
      sqlite3VdbeAddOp2(v, OP_IfNot, regBignull, sqlite3VdbeCurrentAddr(v)+2);
      VdbeCoverage(v);
      if( bStopAtNull ){
        op = aEndOp[bRev*2 + 0];
        assert( op==OP_IdxGE || op==OP_IdxLE );
        sqlite3VdbeAddOp4Int(v, op, iIdxCur, addrNxt, regBase, nConstraint);
        testcase( op==OP_IdxGE );  VdbeCoverageIf(v, op==OP_IdxGE );
        testcase( op==OP_IdxLE );  VdbeCoverageIf(v, op==OP_IdxLE );
      }else{
        op = aEndOp[bRev*2 + endEq];
        sqlite3VdbeAddOp4Int(v, op, iIdxCur, addrNxt, regBase, nConstraint+1);
        testcase( op==OP_IdxGT );  VdbeCoverageIf(v, op==OP_IdxGT );
        testcase( op==OP_IdxGE );  VdbeCoverageIf(v, op==OP_IdxGE );
        testcase( op==OP_IdxLT );  VdbeCoverageIf(v, op==OP_IdxLT );
        testcase( op==OP_IdxLE );  VdbeCoverageIf(v, op==OP_IdxLE );
      }
    }

    if( pLoop->wsFlags & WHERE_IN_EARLYOUT ){
      sqlite3VdbeAddOp2(v, OP_SeekHit, iIdxCur, 1);
    }