/ Check-in [3ec8b37a]
Login

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

Overview
Comment:Remove a condition that is always true from btree.c. (CVS 6798)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:3ec8b37a89fdb2436d312439715414fae2cd20a8
User & Date: danielk1977 2009-06-22 18:03:52
Context
2009-06-22
19:05
Simplifications to vdbe.c and it service routines in support of coverage testing. (CVS 6799) check-in: 308f2e61 user: drh tags: trunk
18:03
Remove a condition that is always true from btree.c. (CVS 6798) check-in: 3ec8b37a user: danielk1977 tags: trunk
12:05
Make sure sqlite3BtreeCreateTable() returns an error code if the largest rootpage field is invalid in auto_vacuum mode. Update file-format comments to describe all of the "meta" values. (CVS 6797) check-in: bda38f5e user: drh 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.637 2009/06/22 12:05:10 drh Exp $
           12  +** $Id: btree.c,v 1.638 2009/06/22 18:03:52 danielk1977 Exp $
    13     13   **
    14     14   ** This file implements a external (disk-based) database using BTrees.
    15     15   ** See the header comment on "btreeInt.h" for additional information.
    16     16   ** Including a description of file format and an overview of operation.
    17     17   */
    18     18   #include "btreeInt.h"
    19     19   
................................................................................
  6397   6397     */
  6398   6398     if(
  6399   6399       SQLITE_OK!=(rc = saveAllCursors(pBt, pCur->pgnoRoot, pCur)) || (!loc &&
  6400   6400       SQLITE_OK!=(rc = sqlite3BtreeMoveto(pCur, pKey, nKey, appendBias, &loc))
  6401   6401     )){
  6402   6402       return rc;
  6403   6403     }
         6404  +  assert( pCur->eState==CURSOR_VALID || (pCur->eState==CURSOR_INVALID && loc) );
  6404   6405   
  6405   6406     pPage = pCur->apPage[pCur->iPage];
  6406   6407     assert( pPage->intKey || nKey>=0 );
  6407   6408     assert( pPage->leaf || !pPage->intKey );
  6408   6409     TRACE(("INSERT: table=%d nkey=%lld ndata=%d page=%d %s\n",
  6409   6410             pCur->pgnoRoot, nKey, nData, pPage->pgno,
  6410   6411             loc==0 ? "overwrite" : "new entry"));
................................................................................
  6413   6414     newCell = pBt->pTmpSpace;
  6414   6415     if( newCell==0 ) return SQLITE_NOMEM;
  6415   6416     rc = fillInCell(pPage, newCell, pKey, nKey, pData, nData, nZero, &szNew);
  6416   6417     if( rc ) goto end_insert;
  6417   6418     assert( szNew==cellSizePtr(pPage, newCell) );
  6418   6419     assert( szNew<=MX_CELL_SIZE(pBt) );
  6419   6420     idx = pCur->aiIdx[pCur->iPage];
  6420         -  if( loc==0 && CURSOR_VALID==pCur->eState ){
         6421  +  if( loc==0 ){
  6421   6422       u16 szOld;
  6422   6423       assert( idx<pPage->nCell );
  6423   6424       rc = sqlite3PagerWrite(pPage->pDbPage);
  6424   6425       if( rc ){
  6425   6426         goto end_insert;
  6426   6427       }
  6427   6428       oldCell = findCell(pPage, idx);