/ Check-in [9830c343]
Login

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

Overview
Comment:Improve clarity of presentation in the sqlite3VdbeMemFromBtree() routine.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:9830c343bc954b828f6ca752f8ae63e2c0a980c1
User & Date: drh 2014-03-04 13:18:23
Context
2014-03-04
16:05
Ensure that BtreeMovetoUnpacked() does not try to invoke xRecordCompare when it is set to NULL. check-in: 2879234b user: dan tags: trunk
14:34
Merge the performance enhancements of trunk (and some obscure bug fixes) into the sessions branch. check-in: 7f51ad97 user: drh tags: sessions
13:18
Improve clarity of presentation in the sqlite3VdbeMemFromBtree() routine. check-in: 9830c343 user: drh tags: trunk
12:07
Fix comment in test. check-in: 1e57f67b user: mistachkin tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/vdbemem.c.

823
824
825
826
827
828
829

830
831
832
833
834
835
836
837
838

839
840
841




842
843
844
845
846
847
848
849
850
851
852
  }
  assert( zData!=0 );

  if( offset+amt<=available ){
    sqlite3VdbeMemRelease(pMem);
    pMem->z = &zData[offset];
    pMem->flags = MEM_Blob|MEM_Ephem;

  }else if( SQLITE_OK==(rc = sqlite3VdbeMemGrow(pMem, amt+2, 0)) ){
    pMem->flags = MEM_Blob|MEM_Term;
    pMem->enc = 0;
    pMem->memType = MEM_Blob;
    if( key ){
      rc = sqlite3BtreeKey(pCur, offset, amt, pMem->z);
    }else{
      rc = sqlite3BtreeData(pCur, offset, amt, pMem->z);
    }

    pMem->z[amt] = 0;
    pMem->z[amt+1] = 0;
    if( rc!=SQLITE_OK ){




      sqlite3VdbeMemRelease(pMem);
    }
  }
  pMem->n = (int)amt;

  return rc;
}

/* This function is only available internally, it is not part of the
** external API. It works in a similar way to sqlite3_value_text(),
** except the data returned is in the encoding specified by the second







>

<
<
<





>
|
|
<
>
>
>
>



<







823
824
825
826
827
828
829
830
831



832
833
834
835
836
837
838
839

840
841
842
843
844
845
846

847
848
849
850
851
852
853
  }
  assert( zData!=0 );

  if( offset+amt<=available ){
    sqlite3VdbeMemRelease(pMem);
    pMem->z = &zData[offset];
    pMem->flags = MEM_Blob|MEM_Ephem;
    pMem->n = (int)amt;
  }else if( SQLITE_OK==(rc = sqlite3VdbeMemGrow(pMem, amt+2, 0)) ){



    if( key ){
      rc = sqlite3BtreeKey(pCur, offset, amt, pMem->z);
    }else{
      rc = sqlite3BtreeData(pCur, offset, amt, pMem->z);
    }
    if( rc==SQLITE_OK ){
      pMem->z[amt] = 0;
      pMem->z[amt+1] = 0;

      pMem->flags = MEM_Blob|MEM_Term;
      pMem->memType = MEM_Blob;
      pMem->n = (int)amt;
    }else{
      sqlite3VdbeMemRelease(pMem);
    }
  }


  return rc;
}

/* This function is only available internally, it is not part of the
** external API. It works in a similar way to sqlite3_value_text(),
** except the data returned is in the encoding specified by the second