/ Check-in [3d2536c4]
Login

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

Overview
Comment:Fix a long-standing bug in btree.c in the sqlite3BtreePrevious() routine. The problem has gone unnoticed before now because it only occurs when you use the OP_Prev opcode on a B+Tree. (CVS 2140)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 3d2536c479c943b3a55047898068625f91c872ae
User & Date: drh 2004-11-22 19:07:10
Context
2004-11-22
19:12
Add initial infrastructure for cursors. In where.c, optimize out clauses of the form "ORDER BY rowid" if a table scan is being performed. Do a reverse table scan if "ORDER BY rowid DESC" is present. (CVS 2141) check-in: fc8c1393 user: drh tags: trunk
19:07
Fix a long-standing bug in btree.c in the sqlite3BtreePrevious() routine. The problem has gone unnoticed before now because it only occurs when you use the OP_Prev opcode on a B+Tree. (CVS 2140) check-in: 3d2536c4 user: drh tags: trunk
15:05
Fix a couple of extra test-suite problems with SQLITE_OMIT_VIEW. (CVS 2139) check-in: 894c142d user: danielk1977 tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/btree.c.

     5      5   ** a legal notice, here is a blessing:
     6      6   **
     7      7   **    May you do good and not evil.
     8      8   **    May you find forgiveness for yourself and forgive others.
     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12         -** $Id: btree.c,v 1.223 2004/11/22 10:02:10 danielk1977 Exp $
           12  +** $Id: btree.c,v 1.224 2004/11/22 19:07:10 drh Exp $
    13     13   **
    14     14   ** This file implements a external (disk-based) database using BTrees.
    15     15   ** For a detailed discussion of BTrees, refer to
    16     16   **
    17     17   **     Donald E. Knuth, THE ART OF COMPUTER PROGRAMMING, Volume 3:
    18     18   **     "Sorting And Searching", pages 473-480. Addison-Wesley
    19     19   **     Publishing Company, Reading, Massachusetts.
................................................................................
  2850   2850           return SQLITE_OK;
  2851   2851         }
  2852   2852         moveToParent(pCur);
  2853   2853         pPage = pCur->pPage;
  2854   2854       }
  2855   2855       pCur->idx--;
  2856   2856       pCur->info.nSize = 0;
  2857         -    if( pPage->leafData ){
         2857  +    if( pPage->leafData && !pPage->leaf ){
  2858   2858         rc = sqlite3BtreePrevious(pCur, pRes);
  2859   2859       }else{
  2860   2860         rc = SQLITE_OK;
  2861   2861       }
  2862   2862     }
  2863   2863     *pRes = 0;
  2864   2864     return rc;