Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Unwind some complex conditions in sqlite3BtreeDelete() into separate "if" statements. (CVS 6879) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
d99bde9ca61eeccfe6363ff0882fd4bc |
User & Date: | drh 2009-07-11 13:13:12.000 |
Context
2009-07-11
| ||
17:04 | Bug fix in the computation of the number of pages to autovacuum when nReserve is greater than zero. (CVS 6880) (check-in: 618a83d65f user: drh tags: trunk) | |
13:13 | Unwind some complex conditions in sqlite3BtreeDelete() into separate "if" statements. (CVS 6879) (check-in: d99bde9ca6 user: drh tags: trunk) | |
11:45 | Remove another unreachable branch from btree.c. (CVS 6878) (check-in: b0853100a9 user: danielk1977 tags: trunk) | |
Changes
Changes to src/btree.c.
1 2 3 4 5 6 7 8 9 10 11 | /* ** 2004 April 6 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | /* ** 2004 April 6 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** $Id: btree.c,v 1.678 2009/07/11 13:13:12 drh Exp $ ** ** This file implements a external (disk-based) database using BTrees. ** See the header comment on "btreeInt.h" for additional information. ** Including a description of file format and an overview of operation. */ #include "btreeInt.h" |
︙ | ︙ | |||
6547 6548 6549 6550 6551 6552 6553 | return rc; } } /* Save the positions of any other cursors open on this table before ** making any modifications. Make the page containing the entry to be ** deleted writable. Then free any overflow pages associated with the | | > | > | > | > | < | < | > | > | < | < | 6547 6548 6549 6550 6551 6552 6553 6554 6555 6556 6557 6558 6559 6560 6561 6562 6563 6564 6565 6566 6567 6568 6569 6570 6571 6572 6573 6574 6575 6576 6577 6578 6579 6580 6581 6582 6583 6584 6585 6586 6587 6588 6589 6590 6591 6592 6593 6594 6595 | return rc; } } /* Save the positions of any other cursors open on this table before ** making any modifications. Make the page containing the entry to be ** deleted writable. Then free any overflow pages associated with the ** entry and finally remove the cell itself from within the page. */ rc = saveAllCursors(pBt, pCur->pgnoRoot, pCur); if( rc ) return rc; rc = sqlite3PagerWrite(pPage->pDbPage); if( rc ) return rc; rc = clearCell(pPage, pCell); if( rc ) return rc; rc = dropCell(pPage, iCellIdx, cellSizePtr(pPage, pCell)); if( rc ) return rc; /* If the cell deleted was not located on a leaf page, then the cursor ** is currently pointing to the largest entry in the sub-tree headed ** by the child-page of the cell that was just deleted from an internal ** node. The cell from the leaf node needs to be moved to the internal ** node to replace the deleted cell. */ if( !pPage->leaf ){ MemPage *pLeaf = pCur->apPage[pCur->iPage]; int nCell; Pgno n = pCur->apPage[iCellDepth+1]->pgno; unsigned char *pTmp; pCell = findCell(pLeaf, pLeaf->nCell-1); nCell = cellSizePtr(pLeaf, pCell); assert( MX_CELL_SIZE(pBt)>=nCell ); allocateTempSpace(pBt); pTmp = pBt->pTmpSpace; rc = sqlite3PagerWrite(pLeaf->pDbPage); if( rc ) return rc; rc = insertCell(pPage, iCellIdx, pCell-4, nCell+4, pTmp, n); if( rc ) return rc; rc = dropCell(pLeaf, pLeaf->nCell-1, nCell); if( rc ) return rc; } /* Balance the tree. If the entry deleted was located on a leaf page, ** then the cursor still points to that page. In this case the first ** call to balance() repairs the tree, and the if(...) condition is ** never true. ** |
︙ | ︙ |