From 21e93ff5ed8458c815d232ecbdccbbbcb801e2d7 Mon Sep 17 00:00:00 2001 From: Tyrel Rink <44035897+tyrelr@users.noreply.github.com> Date: Fri, 23 Dec 2022 21:59:26 -0600 Subject: [PATCH] add logic for delete operation to fix queries grouping by columns from a recursive query --- sqlx-core/src/sqlite/connection/explain.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sqlx-core/src/sqlite/connection/explain.rs b/sqlx-core/src/sqlite/connection/explain.rs index 6f573b7523..486ebe3ad0 100644 --- a/sqlx-core/src/sqlite/connection/explain.rs +++ b/sqlx-core/src/sqlite/connection/explain.rs @@ -19,6 +19,7 @@ const SQLITE_AFF_REAL: u8 = 0x45; /* 'E' */ const OP_INIT: &str = "Init"; const OP_GOTO: &str = "Goto"; const OP_DECR_JUMP_ZERO: &str = "DecrJumpZero"; +const OP_DELETE: &str = "Delete"; const OP_ELSE_EQ: &str = "ElseEq"; const OP_EQ: &str = "Eq"; const OP_END_COROUTINE: &str = "EndCoroutine"; @@ -875,6 +876,15 @@ pub(super) fn explain( //Noop if the register p2 isn't a record, or if pointer p1 does not exist } + OP_DELETE => { + // delete a record from cursor p1 + if let Some(CursorDataType::Normal { is_empty, .. }) = state.p.get_mut(&p1) { + if *is_empty == Some(false) { + *is_empty = None; //the cursor might be empty now + } + } + } + OP_OPEN_PSEUDO => { // Create a cursor p1 aliasing the record from register p2 state.p.insert(p1, CursorDataType::Pseudo(p2));