Skip to content

Commit

Permalink
Fix infinite loading issue for SQLITE
Browse files Browse the repository at this point in the history
  • Loading branch information
TheNeikos committed Aug 9, 2021
1 parent 80d02d2 commit a6fda7b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions sqlx-core/src/sqlite/connection/explain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,19 +86,27 @@ pub(super) async fn explain(

let mut program_i = 0;
let program_size = program.len();
let mut visited = vec![false; program_size];

while program_i < program_size {
if visited[program_i] {
program_i += 1;
continue;
}

let (_, ref opcode, p1, p2, p3, ref p4) = program[program_i];

match &**opcode {
OP_INIT => {
// start at <p2>
visited[program_i] = true;
program_i = p2 as usize;
continue;
}

OP_GOTO => {
// goto <p2>
visited[program_i] = true;
program_i = p2 as usize;
continue;
}
Expand Down Expand Up @@ -230,6 +238,7 @@ pub(super) async fn explain(
}
}

visited[program_i] = true;
program_i += 1;
}

Expand Down

0 comments on commit a6fda7b

Please sign in to comment.