/ Check-in [e956e7db]
Login

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

Overview
Comment:Improved comments on the BtCursor.skipNext field. No changes to code.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | branch-3.8.7
Files: files | file ages | folders
SHA1: e956e7db057d1112badf5e0671cea95201385b44
User & Date: drh 2014-11-17 19:25:15
Context
2014-11-17
19:44
Avoid calling sqlite3BtreeKeysize() on a b-tree cursor in SKIPNEXT or SKIPPREV state. Cherrypick of [54e7d3fcb1]. check-in: 2f2ecb99 user: dan tags: branch-3.8.7
19:25
Improved comments on the BtCursor.skipNext field. No changes to code. check-in: e956e7db user: drh tags: branch-3.8.7
17:13
When a SELECT statement is terminated by a ROLLBACK TO operation, make the error message be "abort due to ROLLBACK" rather than "callback requested query abort". check-in: 34fc4a08 user: drh tags: branch-3.8.7
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/btreeInt.h.

   485    485   **
   486    486   ** A single database file can be shared by two more database connections,
   487    487   ** but cursors cannot be shared.  Each cursor is associated with a
   488    488   ** particular database connection identified BtCursor.pBtree.db.
   489    489   **
   490    490   ** Fields in this structure are accessed under the BtShared.mutex
   491    491   ** found at self->pBt->mutex. 
          492  +**
          493  +** skipNext meaning:
          494  +**    eState==SKIPNEXT && skipNext>0:  Next sqlite3BtreeNext() is no-op.
          495  +**    eState==SKIPNEXT && skipNext<0:  Next sqlite3BtreePrevious() is no-op.
          496  +**    eState==FAULT:                   Cursor fault with skipNext as error code.
   492    497   */
   493    498   struct BtCursor {
   494    499     Btree *pBtree;            /* The Btree to which this cursor belongs */
   495    500     BtShared *pBt;            /* The BtShared this cursor points to */
   496    501     BtCursor *pNext, *pPrev;  /* Forms a linked list of all cursors */
   497    502     struct KeyInfo *pKeyInfo; /* Argument passed to comparison function */
   498    503     Pgno *aOverflow;          /* Cache of overflow page locations */
   499    504     CellInfo info;            /* A parse of the cell we are pointing at */
   500    505     i64 nKey;                 /* Size of pKey, or last integer key */
   501    506     void *pKey;               /* Saved key that was cursor last known position */
   502    507     Pgno pgnoRoot;            /* The root page of this tree */
   503    508     int nOvflAlloc;           /* Allocated size of aOverflow[] array */
   504         -  int skipNext;    /* Prev() is noop if negative. Next() is noop if positive */
          509  +  int skipNext;    /* Prev() is noop if negative. Next() is noop if positive.
          510  +                   ** Error code if eState==CURSOR_FAULT */
   505    511     u8 curFlags;              /* zero or more BTCF_* flags defined below */
   506    512     u8 eState;                /* One of the CURSOR_XXX constants (see below) */
   507    513     u8 hints;                             /* As configured by CursorSetHints() */
   508    514     i16 iPage;                            /* Index of current page in apPage */
   509    515     u16 aiIdx[BTCURSOR_MAX_DEPTH];        /* Current index in apPage[i] */
   510    516     MemPage *apPage[BTCURSOR_MAX_DEPTH];  /* Pages from root to current page */
   511    517   };
................................................................................
   543    549   **   seek the cursor to the saved position.
   544    550   **
   545    551   ** CURSOR_FAULT:
   546    552   **   An unrecoverable error (an I/O error or a malloc failure) has occurred
   547    553   **   on a different connection that shares the BtShared cache with this
   548    554   **   cursor.  The error has left the cache in an inconsistent state.
   549    555   **   Do nothing else with this cursor.  Any attempt to use the cursor
   550         -**   should return the error code stored in BtCursor.skip
          556  +**   should return the error code stored in BtCursor.skipNext
   551    557   */
   552    558   #define CURSOR_INVALID           0
   553    559   #define CURSOR_VALID             1
   554    560   #define CURSOR_SKIPNEXT          2
   555    561   #define CURSOR_REQUIRESEEK       3
   556    562   #define CURSOR_FAULT             4
   557    563