aboutsummaryrefslogtreecommitdiff
path: root/src/btree.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2018-01-04 19:54:55 +0000
committerdrh <drh@noemail.net>2018-01-04 19:54:55 +0000
commitc76ed3d57dfbe7b1080f362a7a59ea6ee25e6bb2 (patch)
tree111c4a7f9be0604bb90f3fba54f2a71faded8a4b /src/btree.c
parent0cde0c62b1e53c01d72a9a9227010e6afc4032dc (diff)
parent35100fb194cfbaf75b31b504e7bf7d4480900c26 (diff)
downloadsqlite-c76ed3d57dfbe7b1080f362a7a59ea6ee25e6bb2.tar.gz
sqlite-c76ed3d57dfbe7b1080f362a7a59ea6ee25e6bb2.zip
Merge in all recent trunk enhancements.
FossilOrigin-Name: 406f79183736b6ad360169b837172afef2c82a4312f5787db08c54167a44b15e
Diffstat (limited to 'src/btree.c')
-rw-r--r--src/btree.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/btree.c b/src/btree.c
index 0fa00a2e1..8cd5ee673 100644
--- a/src/btree.c
+++ b/src/btree.c
@@ -4432,6 +4432,20 @@ i64 sqlite3BtreeIntegerKey(BtCursor *pCur){
return pCur->info.nKey;
}
+#ifdef SQLITE_ENABLE_OFFSET_SQL_FUNC
+/*
+** Return the offset into the database file for the start of the
+** payload to which the cursor is pointing.
+*/
+i64 sqlite3BtreeOffset(BtCursor *pCur){
+ assert( cursorHoldsMutex(pCur) );
+ assert( pCur->eState==CURSOR_VALID );
+ getCellInfo(pCur);
+ return (i64)pCur->pBt->pageSize*((i64)pCur->pPage->pgno - 1) +
+ (i64)(pCur->info.pPayload - pCur->pPage->aData);
+}
+#endif /* SQLITE_ENABLE_OFFSET_SQL_FUNC */
+
/*
** Return the number of bytes of payload for the entry that pCur is
** currently pointing to. For table btrees, this will be the amount