SQLite

Check-in [ebe4845c]
Login

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

Overview
Comment:Ensure that the sqlite3BtreeLast() interface initializes the *pRes return to zero if the cursor is already sitting on the last entry of the table. Manuel Rigger found the obscure test case for which this makes a difference.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: ebe4845cd0ffb96b30be3c69eb399d58e93149886bc2fa60a7ebd7b4fbe447a4
User & Date: drh 2019-05-08 23:55:04
Original Comment: Ensure that the sqlite3BtreeLast() interface initializes the *pRes return to zero if the cursor is already sitting on the last entry of the table.
Context
2019-05-09
11:19
Fix a problem in the new code introduced by [658b84d7] causing corruption and other errors to be ignored. (check-in: 7ccf2e7d user: dan tags: trunk)
11:18
Improved error handling for the ".open --hexdb" command of the CLI. (check-in: 4fa831d5 user: drh tags: trunk)
2019-05-08
23:55
Ensure that the sqlite3BtreeLast() interface initializes the *pRes return to zero if the cursor is already sitting on the last entry of the table. Manuel Rigger found the obscure test case for which this makes a difference. (check-in: ebe4845c user: drh tags: trunk)
23:53
This is part of the previous check-in that didn't get committed for some reason - probably because I failed to press the "Save" button on the text editor. (check-in: 51d32173 user: drh tags: trunk)
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/btree.c.

5290
5291
5292
5293
5294
5295
5296

5297
5298
5299
5300
5301
5302
5303
    int ii;
    for(ii=0; ii<pCur->iPage; ii++){
      assert( pCur->aiIdx[ii]==pCur->apPage[ii]->nCell );
    }
    assert( pCur->ix==pCur->pPage->nCell-1 );
    assert( pCur->pPage->leaf );
#endif

    return SQLITE_OK;
  }

  rc = moveToRoot(pCur);
  if( rc==SQLITE_OK ){
    assert( pCur->eState==CURSOR_VALID );
    *pRes = 0;







>







5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
    int ii;
    for(ii=0; ii<pCur->iPage; ii++){
      assert( pCur->aiIdx[ii]==pCur->apPage[ii]->nCell );
    }
    assert( pCur->ix==pCur->pPage->nCell-1 );
    assert( pCur->pPage->leaf );
#endif
    *pRes = 0;
    return SQLITE_OK;
  }

  rc = moveToRoot(pCur);
  if( rc==SQLITE_OK ){
    assert( pCur->eState==CURSOR_VALID );
    *pRes = 0;