SQLite4
Check-in [0a923f20d2]
Not logged in

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

Overview
Comment:Fix minor errors in the key encoder.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 0a923f20d22fae949c4fff611ec4e738e6431a73
User & Date: drh 2013-07-26 16:59:18
Context
2013-07-26
19:13
Fix some issues with assigning costs to loops in where.c. check-in: faac50a266 user: dan tags: trunk
16:59
Fix minor errors in the key encoder. check-in: 0a923f20d2 user: drh tags: trunk
16:20
Change the data encoding (again) to make content-in-key use fewer bytes, since one suspects that this will become a common encoding. FILE FORMAT CHANGE. check-in: 0275ee48db user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/vdbecodec.c.

739
740
741
742
743
744
745
746
747
748



749
750
751
752
753
754
755
...
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
}

/*
** Write value num into buffer p using the key encoding.
*/
static void encodeNumericKey(KeyEncoder *p, sqlite4_num num){
  if( num.m==0 ){
    p->aOut[p->nOut++] = 0x15;  /* Numeric zero */
  }else if( sqlite4_num_isnan(num) ){
    p->aOut[p->nOut++] = 0x06;  /* NaN */



  }else if( sqlite4_num_isinf(num) ){
    p->aOut[p->nOut++] = num.sign ? 0x07 : 0x23;  /* Neg and Pos infinity */
  }else{
    int e;
    u64 m;
    int iDigit = 0;
    u8 aDigit[12];
................................................................................

    while( m ){
      aDigit[iDigit++] = (m % 100);
      m = m / 100;
    }
    e = (iDigit + (e/2));

    if( e>11 ){                 /* Large value */
      if( num.sign==0 ){
        p->aOut[p->nOut++] = 0x22;
        putVarint64(p, e, 0);
      }else{
        p->aOut[p->nOut++] = 0x08;
        putVarint64(p, e, 1);
      }







<
|
|
>
>
>







 







|







739
740
741
742
743
744
745

746
747
748
749
750
751
752
753
754
755
756
757
...
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
}

/*
** Write value num into buffer p using the key encoding.
*/
static void encodeNumericKey(KeyEncoder *p, sqlite4_num num){
  if( num.m==0 ){

    if( sqlite4_num_isnan(num) ){
      p->aOut[p->nOut++] = 0x06;  /* NaN */
    }else{
      p->aOut[p->nOut++] = 0x15;  /* Numeric zero */
    }
  }else if( sqlite4_num_isinf(num) ){
    p->aOut[p->nOut++] = num.sign ? 0x07 : 0x23;  /* Neg and Pos infinity */
  }else{
    int e;
    u64 m;
    int iDigit = 0;
    u8 aDigit[12];
................................................................................

    while( m ){
      aDigit[iDigit++] = (m % 100);
      m = m / 100;
    }
    e = (iDigit + (e/2));

    if( e>=11 ){                /* Large value */
      if( num.sign==0 ){
        p->aOut[p->nOut++] = 0x22;
        putVarint64(p, e, 0);
      }else{
        p->aOut[p->nOut++] = 0x08;
        putVarint64(p, e, 1);
      }