Skip to content

Commit 21e93ff

Browse files
committed
add logic for delete operation to fix queries grouping by columns from a recursive query
1 parent 6f7b5d9 commit 21e93ff

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

sqlx-core/src/sqlite/connection/explain.rs

+10
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ const SQLITE_AFF_REAL: u8 = 0x45; /* 'E' */
1919
const OP_INIT: &str = "Init";
2020
const OP_GOTO: &str = "Goto";
2121
const OP_DECR_JUMP_ZERO: &str = "DecrJumpZero";
22+
const OP_DELETE: &str = "Delete";
2223
const OP_ELSE_EQ: &str = "ElseEq";
2324
const OP_EQ: &str = "Eq";
2425
const OP_END_COROUTINE: &str = "EndCoroutine";
@@ -875,6 +876,15 @@ pub(super) fn explain(
875876
//Noop if the register p2 isn't a record, or if pointer p1 does not exist
876877
}
877878

879+
OP_DELETE => {
880+
// delete a record from cursor p1
881+
if let Some(CursorDataType::Normal { is_empty, .. }) = state.p.get_mut(&p1) {
882+
if *is_empty == Some(false) {
883+
*is_empty = None; //the cursor might be empty now
884+
}
885+
}
886+
}
887+
878888
OP_OPEN_PSEUDO => {
879889
// Create a cursor p1 aliasing the record from register p2
880890
state.p.insert(p1, CursorDataType::Pseudo(p2));

0 commit comments

Comments
 (0)