aboutsummaryrefslogtreecommitdiff
path: root/src/btree.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2019-12-29 22:08:20 +0000
committerdrh <drh@noemail.net>2019-12-29 22:08:20 +0000
commit7b14b65d20a2ba85bd90689772f605ba5a32bfed (patch)
tree34eef6b441e57ad0a4489edc1fdb5cbced1e05b8 /src/btree.c
parentbe3da24134f53a0c8f10291611af758dc0ced611 (diff)
downloadsqlite-7b14b65d20a2ba85bd90689772f605ba5a32bfed.tar.gz
sqlite-7b14b65d20a2ba85bd90689772f605ba5a32bfed.zip
Do not allow triggers that run as part of REPLACE conflict resolution
during an UPDATE to modify the the table being updated. Otherwise, those triggers might delete content out from under the update operation, leading to all kinds of problems. Ticket [314cc133e5ada126] FossilOrigin-Name: db4b7e1dc399c1f16b827ac087aa37c0815f4b2f41f1ffad59963eead2ab5562
Diffstat (limited to 'src/btree.c')
-rw-r--r--src/btree.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/btree.c b/src/btree.c
index eb80816bb..a137da3c7 100644
--- a/src/btree.c
+++ b/src/btree.c
@@ -699,6 +699,9 @@ static int saveCursorPosition(BtCursor *pCur){
assert( 0==pCur->pKey );
assert( cursorHoldsMutex(pCur) );
+ if( pCur->curFlags & BTCF_Pinned ){
+ return SQLITE_CONSTRAINT_PINNED;
+ }
if( pCur->eState==CURSOR_SKIPNEXT ){
pCur->eState = CURSOR_VALID;
}else{
@@ -4562,6 +4565,18 @@ i64 sqlite3BtreeIntegerKey(BtCursor *pCur){
return pCur->info.nKey;
}
+/*
+** Pin or unpin a cursor.
+*/
+void sqlite3BtreeCursorPin(BtCursor *pCur){
+ assert( (pCur->curFlags & BTCF_Pinned)==0 );
+ pCur->curFlags |= BTCF_Pinned;
+}
+void sqlite3BtreeCursorUnpin(BtCursor *pCur){
+ assert( (pCur->curFlags & BTCF_Pinned)!=0 );
+ pCur->curFlags &= ~BTCF_Pinned;
+}
+
#ifdef SQLITE_ENABLE_OFFSET_SQL_FUNC
/*
** Return the offset into the database file for the start of the