/ Check-in [df02175e]
Login

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

Overview
Comment:Remove unused code from OP_IdxLt and OP_IdxGE. (CVS 5030)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: df02175ec0f28d57942b8275b540ff855dfbeb09
User & Date: danielk1977 2008-04-18 11:31:13
Context
2008-04-19
14:06
Fix a typo in the documentation on sqlite3_open_v2(). (CVS 5031) check-in: f7b62daa user: drh tags: trunk
2008-04-18
11:31
Remove unused code from OP_IdxLt and OP_IdxGE. (CVS 5030) check-in: df02175e user: danielk1977 tags: trunk
10:25
Combine cases 3 and 4 in where.c, since case 4 is now a special case of case 3. (CVS 5029) check-in: 9a976819 user: danielk1977 tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/vdbe.c.

39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
....
3828
3829
3830
3831
3832
3833
3834
3835
3836

3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852

3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873

3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887

3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
**
** Various scripts scan this source file in order to generate HTML
** documentation, headers files, or other derived files.  The formatting
** of the code in this file is, therefore, important.  See other comments
** in this file for details.  If in doubt, do not deviate from existing
** commenting and indentation practices when changing or adding code.
**
** $Id: vdbe.c,v 1.732 2008/04/18 10:25:24 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
#include "vdbeInt.h"

/*
** The following global variable is incremented every time a cursor
................................................................................
      MemSetTypeFlag(pOut, MEM_Int);
      pOut->u.i = rowid;
    }
  }
  break;
}

/* Opcode: IdxGE P1 P2 P3 * P5
**

** The value in register P3 is an index entry that omits the ROWID.  Compare
** this value against the index that P1 is currently pointing to.
** Ignore the ROWID on the P1 index.
**
** If the P1 index entry is greater than or equal to the value in 
** register P3 then jump to P2.  Otherwise fall through to the next 
** instruction.
**
** If P5 is non-zero then the value in register P3 is temporarily
** increased by an epsilon prior to the comparison.  This make the opcode work
** like IdxGT except that if the key from register P3 is a prefix of
** the key in the cursor, the result is false whereas it would be
** true with IdxGT.
*/
/* Opcode: IdxLT P1 P2 P3 * P5
**

** The value in register P3 is an index entry that omits the ROWID.  Compare
** the this value against the index that P1 is currently pointing to.
** Ignore the ROWID on the P1 index.
**
** If the P1 index entry is less than the register P3 value
** then jump to P2.  Otherwise fall through to the next instruction.
**
** If P5 is non-zero then the index taken from register P3 is temporarily 
** increased by an epsilon prior to the comparison.  This makes the opcode 
** work like IdxLE.
*/
case OP_IdxLT:          /* jump, in3 */
case OP_IdxGE: {        /* jump, in3 */
  int i= pOp->p1;
  Cursor *pC;

  assert( i>=0 && i<p->nCursor );
  assert( p->apCsr[i]!=0 );
  if( (pC = p->apCsr[i])->pCursor!=0 ){
    int res;
 

    assert( pC->deferredMoveto==0 );
    assert( pOp->p5==0 || pOp->p5==1 );
    *pC->pIncrKey = pOp->p5;
    if( pOp->p4type!=P4_INT32 || pOp->p4.i==0 ){
      assert( pIn3->flags & MEM_Blob );  /* Created using OP_MakeRecord */
      ExpandBlob(pIn3);
      rc = sqlite3VdbeIdxKeyCompare(pC, 0, pIn3->n, (u8*)pIn3->z, &res);
    }else{
      UnpackedRecord r;
      r.pKeyInfo = pC->pKeyInfo;
      r.nField = pOp->p4.i;
      r.needFree = 0;
      r.needDestroy = 0;
      r.aMem = &p->aMem[pOp->p3];

      rc = sqlite3VdbeIdxKeyCompare(pC, &r, 0, 0, &res);
    }
    *pC->pIncrKey = 0;
    if( rc!=SQLITE_OK ){
      break;
    }
    if( pOp->opcode==OP_IdxLT ){
      res = -res;
    }else{
      assert( pOp->opcode==OP_IdxGE );
      res++;
    }
    if( res>0 ){







|







 







|

>
|
|
<

|
|
<

|
|
|
|
<



>
|
|
<

|
|

|
|
<










<
>


|
<
<
<
<
<
<
|
|
|
|
|
>
|
<

<
<
<







39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
....
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839

3840
3841
3842

3843
3844
3845
3846
3847

3848
3849
3850
3851
3852
3853

3854
3855
3856
3857
3858
3859

3860
3861
3862
3863
3864
3865
3866
3867
3868
3869

3870
3871
3872
3873






3874
3875
3876
3877
3878
3879
3880

3881



3882
3883
3884
3885
3886
3887
3888
**
** Various scripts scan this source file in order to generate HTML
** documentation, headers files, or other derived files.  The formatting
** of the code in this file is, therefore, important.  See other comments
** in this file for details.  If in doubt, do not deviate from existing
** commenting and indentation practices when changing or adding code.
**
** $Id: vdbe.c,v 1.733 2008/04/18 11:31:13 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
#include "vdbeInt.h"

/*
** The following global variable is incremented every time a cursor
................................................................................
      MemSetTypeFlag(pOut, MEM_Int);
      pOut->u.i = rowid;
    }
  }
  break;
}

/* Opcode: IdxGE P1 P2 P3 P4 P5
**
** The P4 register values beginning with P3 form an unpacked index 
** key that omits the ROWID.  Compare this key value against the index 
** that P1 is currently pointing to, ignoring the ROWID on the P1 index.

**
** If the P1 index entry is greater than or equal to the key value
** then jump to P2.  Otherwise fall through to the next instruction.

**
** If P5 is non-zero then the key value is increased by an epsilon 
** prior to the comparison.  This make the opcode work like IdxGT except
** that if the key from register P3 is a prefix of the key in the cursor,
** the result is false whereas it would be true with IdxGT.

*/
/* Opcode: IdxLT P1 P2 P3 * P5
**
** The P4 register values beginning with P3 form an unpacked index 
** key that omits the ROWID.  Compare this key value against the index 
** that P1 is currently pointing to, ignoring the ROWID on the P1 index.

**
** If the P1 index entry is less than the key value then jump to P2.
** Otherwise fall through to the next instruction.
**
** If P5 is non-zero then the key value is increased by an epsilon prior 
** to the comparison.  This makes the opcode work like IdxLE.

*/
case OP_IdxLT:          /* jump, in3 */
case OP_IdxGE: {        /* jump, in3 */
  int i= pOp->p1;
  Cursor *pC;

  assert( i>=0 && i<p->nCursor );
  assert( p->apCsr[i]!=0 );
  if( (pC = p->apCsr[i])->pCursor!=0 ){
    int res;

    UnpackedRecord r;
    assert( pC->deferredMoveto==0 );
    assert( pOp->p5==0 || pOp->p5==1 );
    assert( pOp->p4type==P4_INT32 );






    r.pKeyInfo = pC->pKeyInfo;
    r.nField = pOp->p4.i;
    r.needFree = 0;
    r.needDestroy = 0;
    r.aMem = &p->aMem[pOp->p3];
    *pC->pIncrKey = pOp->p5;
    rc = sqlite3VdbeIdxKeyCompare(pC, &r, 0, 0, &res);

    *pC->pIncrKey = 0;



    if( pOp->opcode==OP_IdxLT ){
      res = -res;
    }else{
      assert( pOp->opcode==OP_IdxGE );
      res++;
    }
    if( res>0 ){