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

Overview
Comment:Remove OP_Int64 and OP_Real. OP_Num is now used instead.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | sqlite4-num
Files: files | file ages | folders
SHA1: 860695f9be77e7658f41f3fa95d84dd0daf24d49
User & Date: dan 2013-05-31 19:34:06.730
Context
2013-05-31
19:37
Merge sqlite4-num branch with trunk. check-in: 7b0d1cf7f4 user: dan tags: trunk
19:34
Remove OP_Int64 and OP_Real. OP_Num is now used instead. Leaf check-in: 860695f9be user: dan tags: sqlite4-num
19:19
Remove uses of type 'double' from the vdbe. check-in: e018823162 user: dan tags: sqlite4-num
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/expr.c.
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
    if( p ){
      *p = sqlite4_num_from_text(z, -1, 0, 0);
      assert( p->sign==0 );
      assert( negateFlag==0 || negateFlag==1 );
      p->sign = negateFlag;
      sqlite4VdbeAddOp4(v, OP_Num, 0, iMem, 0, (const char *)p, P4_NUM);
    }
#if 0
    double value;
    char *zV;
    sqlite4AtoF(z, &value, sqlite4Strlen30(z), SQLITE4_UTF8);
    assert( !sqlite4IsNaN(value) ); /* The new AtoF never returns NaN */
    if( negateFlag ) value = -value;
    zV = dup8bytes(v, (char*)&value);
    sqlite4VdbeAddOp4(v, OP_Real, 0, iMem, 0, zV, P4_REAL);
#endif
  }
}
#endif


/*
** Generate an instruction that will put the integer describe by







<
<
<
<
<
<
<
<
<







1908
1909
1910
1911
1912
1913
1914









1915
1916
1917
1918
1919
1920
1921
    if( p ){
      *p = sqlite4_num_from_text(z, -1, 0, 0);
      assert( p->sign==0 );
      assert( negateFlag==0 || negateFlag==1 );
      p->sign = negateFlag;
      sqlite4VdbeAddOp4(v, OP_Num, 0, iMem, 0, (const char *)p, P4_NUM);
    }









  }
}
#endif


/*
** Generate an instruction that will put the integer describe by
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
    assert( z!=0 );

    p = (sqlite4_num *)sqlite4DbMallocRaw(pParse->db, sizeof(sqlite4_num));
    if( p ){
      *p = sqlite4_num_from_text(z, -1, (negFlag ? SQLITE4_NEGATIVE : 0), 0);
      sqlite4VdbeAddOp4(v, OP_Num, p->e==0, iMem, 0, (const char *)p, P4_NUM);
    }

#if 0
    c = sqlite4Atoi64(z, &value, sqlite4Strlen30(z), SQLITE4_UTF8);
    if( c==0 || (c==2 && negFlag) ){
      char *zV;
      if( negFlag ){ value = c==2 ? SMALLEST_INT64 : -value; }
      zV = dup8bytes(v, (char*)&value);
      sqlite4VdbeAddOp4(v, OP_Int64, 0, iMem, 0, zV, P4_INT64);
    }else{
#ifdef SQLITE4_OMIT_FLOATING_POINT
      sqlite4ErrorMsg(pParse, "oversized integer: %s%s", negFlag ? "-" : "", z);
#else
      codeReal(v, z, negFlag, iMem);
#endif
    }
#endif
  }
}

/*
** Clear a cache entry.
*/
static void cacheEntryClear(Parse *pParse, ParseYColCache *p){







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







1938
1939
1940
1941
1942
1943
1944
















1945
1946
1947
1948
1949
1950
1951
    assert( z!=0 );

    p = (sqlite4_num *)sqlite4DbMallocRaw(pParse->db, sizeof(sqlite4_num));
    if( p ){
      *p = sqlite4_num_from_text(z, -1, (negFlag ? SQLITE4_NEGATIVE : 0), 0);
      sqlite4VdbeAddOp4(v, OP_Num, p->e==0, iMem, 0, (const char *)p, P4_NUM);
    }
















  }
}

/*
** Clear a cache entry.
*/
static void cacheEntryClear(Parse *pParse, ParseYColCache *p){
Changes to src/pragma.c.
43
44
45
46
47
48
49


50
51
52
53
54
55
56
57
58
59
60
61

/*
** Generate code to return a single integer value.
*/
static void returnSingleInt(Parse *pParse, const char *zLabel, i64 value){
  Vdbe *v = sqlite4GetVdbe(pParse);
  int mem = ++pParse->nMem;


  i64 *pI64 = sqlite4DbMallocRaw(pParse->db, sizeof(value));
  if( pI64 ){
    memcpy(pI64, &value, sizeof(value));
  }
  sqlite4VdbeAddOp4(v, OP_Int64, 0, mem, 0, (char*)pI64, P4_INT64);
  sqlite4VdbeSetNumCols(v, 1);
  sqlite4VdbeSetColName(v, 0, COLNAME_NAME, zLabel, SQLITE4_STATIC);
  sqlite4VdbeAddOp2(v, OP_ResultRow, mem, 1);
}

#ifndef SQLITE4_OMIT_FLAG_PRAGMAS
/*







>
>
|
|
|

|







43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63

/*
** Generate code to return a single integer value.
*/
static void returnSingleInt(Parse *pParse, const char *zLabel, i64 value){
  Vdbe *v = sqlite4GetVdbe(pParse);
  int mem = ++pParse->nMem;
  sqlite4_num *pNum;

  pNum = sqlite4DbMallocRaw(pParse->db, sizeof(value));
  if( pNum ){
    *pNum = sqlite4_num_from_int64(value);
  }
  sqlite4VdbeAddOp4(v, OP_Num, 1, mem, 0, (char *)pNum, P4_NUM);
  sqlite4VdbeSetNumCols(v, 1);
  sqlite4VdbeSetColName(v, 0, COLNAME_NAME, zLabel, SQLITE4_STATIC);
  sqlite4VdbeAddOp2(v, OP_ResultRow, mem, 1);
}

#ifndef SQLITE4_OMIT_FLAG_PRAGMAS
/*
Changes to src/vdbe.c.
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
** The 32-bit integer value P1 is written into register P2.
*/
case OP_Integer: {         /* out2-prerelease */
  pOut->u.num = sqlite4_num_from_int64((i64)pOp->p1);
  break;
}

/* Opcode: Int64 * P2 * P4 *
**
** P4 is a pointer to a 64-bit integer value.
** Write that value into register P2.
*/
case OP_Int64: {           /* out2-prerelease */
  assert( pOp->p4.pI64!=0 );
  pOut->u.num = sqlite4_num_from_int64(*pOp->p4.pI64);
  break;
}

#ifndef SQLITE4_OMIT_FLOATING_POINT
/* Opcode: Real * P2 * P4 *
**
** P4 is a pointer to a 64-bit floating point value.
** Write that value into register P2.
*/
case OP_Real: {            /* same as TK_FLOAT, out2-prerelease */
  pOut->flags = MEM_Real;
  assert( !sqlite4IsNaN(*pOp->p4.pReal) );
  pOut->u.num = sqlite4_num_from_double(*pOp->p4.pReal);
  break;
}
#endif

/* Opcode: Num P1 P2 * P4 *
**
** P4 is a pointer to an sqlite4_num value. Write that value into 
** register P2. Set the register flags to MEM_Int if P1 is non-zero,
** or MEM_Real otherwise.
*/
case OP_Num: {            /* out2-prerelease */







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







846
847
848
849
850
851
852

























853
854
855
856
857
858
859
** The 32-bit integer value P1 is written into register P2.
*/
case OP_Integer: {         /* out2-prerelease */
  pOut->u.num = sqlite4_num_from_int64((i64)pOp->p1);
  break;
}


























/* Opcode: Num P1 P2 * P4 *
**
** P4 is a pointer to an sqlite4_num value. Write that value into 
** register P2. Set the register flags to MEM_Int if P1 is non-zero,
** or MEM_Real otherwise.
*/
case OP_Num: {            /* out2-prerelease */