/ Check-in [6e0298cd]
Login

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

Overview
Comment:This change is not correct for the boundary case of nCellKey==0. Was: Small performance gain and size reduction in sqlite3VdbeIdxKeyCompare().
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | mistake
Files: files | file ages | folders
SHA1: 6e0298cdcb3b900fedac0eebdc7cfd69a763a44b
User & Date: drh 2015-09-02 12:52:05
Original Comment: Small performance gain and size reduction in sqlite3VdbeIdxKeyCompare().
Context
2015-09-02
12:52
This change is not correct for the boundary case of nCellKey==0. Was: Small performance gain and size reduction in sqlite3VdbeIdxKeyCompare(). Closed-Leaf check-in: 6e0298cd user: drh tags: mistake
2015-09-01
23:51
Very minor optimizations in the unix VFS. check-in: 6db3ff45 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/vdbeaux.c.

  4131   4131     int rc;
  4132   4132     BtCursor *pCur = pC->pCursor;
  4133   4133     Mem m;
  4134   4134   
  4135   4135     assert( sqlite3BtreeCursorIsValid(pCur) );
  4136   4136     VVA_ONLY(rc =) sqlite3BtreeKeySize(pCur, &nCellKey);
  4137   4137     assert( rc==SQLITE_OK );    /* pCur is always valid so KeySize cannot fail */
  4138         -  /* nCellKey will always be between 0 and 0xffffffff because of the way
         4138  +  /* nCellKey will always be between 0 and 0x7fffffff because of the way
  4139   4139     ** that btreeParseCellPtr() and sqlite3GetVarint32() are implemented */
  4140         -  if( nCellKey<=0 || nCellKey>0x7fffffff ){
         4140  +  if( (nCellKey & ~(i64)0x7fffffff)!=0 ){
  4141   4141       *res = 0;
  4142   4142       return SQLITE_CORRUPT_BKPT;
  4143   4143     }
         4144  +  assert( nCellKey>=0 && nCellKey<=0x7fffffff );
  4144   4145     sqlite3VdbeMemInit(&m, db, 0);
  4145   4146     rc = sqlite3VdbeMemFromBtree(pC->pCursor, 0, (u32)nCellKey, 1, &m);
  4146   4147     if( rc ){
  4147   4148       return rc;
  4148   4149     }
  4149   4150     *res = sqlite3VdbeRecordCompare(m.n, m.z, pUnpacked);
  4150   4151     sqlite3VdbeMemRelease(&m);