Skip to content

Commit

Permalink
add logic for delete operation to fix queries grouping by columns fro…
Browse files Browse the repository at this point in the history
…m a recursive query
  • Loading branch information
tyrelr committed Dec 24, 2022
1 parent 6f7b5d9 commit 21e93ff
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions sqlx-core/src/sqlite/connection/explain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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));
Expand Down

0 comments on commit 21e93ff

Please sign in to comment.