1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-05 15:55:57 +03:00

Comment changes that attempt to better explain the behavior of the "seekResult"

field on VdbeCursor objects and the seekResult parameter to
sqlite3BtreeInsert() and the OPFLAG_USESEEKRESULT flag on insert opcodes.
No changes to code.

FossilOrigin-Name: 345b46be75bdf6f9fb7367a6164d89bae11995a6
This commit is contained in:
drh
2016-11-09 20:14:34 +00:00
parent 7405fa745e
commit eaf6ae2992
5 changed files with 34 additions and 32 deletions

View File

@@ -7940,17 +7940,19 @@ static int balance(BtCursor *pCur){
** pX.pData,nData,nZero fields must be zero.
**
** If the seekResult parameter is non-zero, then a successful call to
** MovetoUnpacked() to seek cursor pCur to (pKey, nKey) has already
** been performed. seekResult is the search result returned (a negative
** number if pCur points at an entry that is smaller than (pKey, nKey), or
** a positive value if pCur points at an entry that is larger than
** (pKey, nKey)).
** MovetoUnpacked() to seek cursor pCur to (pKey,nKey) has already
** been performed. In other words, if seekResult!=0 then the cursor
** is currently pointing to a cell that will be adjacent to the cell
** to be inserted. If seekResult<0 then pCur points to a cell that is
** smaller then (pKey,nKey). If seekResult>0 then pCur points to a cell
** that is larger than (pKey,nKey).
**
** If the seekResult parameter is non-zero, then the caller guarantees that
** cursor pCur is pointing at the existing copy of a row that is to be
** overwritten. If the seekResult parameter is 0, then cursor pCur may
** point to any entry or to no entry at all and so this function has to seek
** the cursor before the new key can be inserted.
** If seekResult==0, that means pCur is pointing at some unknown location.
** In that case, this routine must seek the cursor to the correct insertion
** point for (pKey,nKey) before doing the insertion. For index btrees,
** if pX->nMem is non-zero, then pX->aMem contains pointers to the unpacked
** key values and pX->aMem can be used instead of pX->pKey to avoid having
** to decode the key.
*/
int sqlite3BtreeInsert(
BtCursor *pCur, /* Insert data into the table of this cursor */