// was:sqlite3BtreeCloseCursor public RC Close() { if (Tree != null) { Tree.sqlite3BtreeEnter(); Clear(); if (Prev != null) { Prev.Next = Next; } else { Shared.Cursors = Next; } if (Next != null) { Next.Prev = Prev; } for (var id = 0; id <= PageID; id++) { Pages[id].releasePage(); } Shared.unlockBtreeIfUnused(); Btree.invalidateOverflowCache(this); Tree.sqlite3BtreeLeave(); } return(RC.OK); }
// was:saveCursorPosition internal RC SavePosition() { Debug.Assert(State == CursorState.VALID); Debug.Assert(Key == null); Debug.Assert(HoldsMutex()); NKey = GetKeySize(); // If this is an intKey table, then the above call to BtreeKeySize() stores the integer key in pCur.nKey. In this case this value is // all that is required. Otherwise, if pCur is not open on an intKey table, then malloc space for and store the pCur.nKey bytes of key data. var rc = RC.OK; if (!Pages[0].HasIntKey) { var pKey = MallocEx.sqlite3Malloc((int)NKey); rc = GetKey(0, (uint)NKey, pKey); if (rc == RC.OK) { Key = pKey; } } Debug.Assert(!Pages[0].HasIntKey || Key == null); if (rc == RC.OK) { for (var i = 0; i <= PageID; i++) { Pages[i].releasePage(); Pages[i] = null; } PageID = -1; State = CursorState.REQUIRESEEK; } Btree.invalidateOverflowCache(this); return(rc); }
// was:sqlite3BtreeCacheOverflow public void BtreeCacheOverflow() { Debug.Assert(HoldsMutex()); Debug.Assert(MutexEx.Held(Tree.DB.Mutex)); Btree.invalidateOverflowCache(this); IsIncrblob = true; }