From afad06fb2388c68034f7f0336e52b1ddb8a917ae Mon Sep 17 00:00:00 2001 From: Jussi Saurio Date: Thu, 10 Apr 2025 15:06:45 +0300 Subject: [PATCH] vdbe/explain: add key info to Seek/Idx insns --- core/vdbe/explain.rs | 64 ++++++++++++++++---------------------------- 1 file changed, 23 insertions(+), 41 deletions(-) diff --git a/core/vdbe/explain.rs b/core/vdbe/explain.rs index 3d46bc41b..3ce60f5db 100644 --- a/core/vdbe/explain.rs +++ b/core/vdbe/explain.rs @@ -748,28 +748,28 @@ pub fn insn_to_str( is_index: _, cursor_id, start_reg, - num_regs: _, + num_regs, target_pc, } | Insn::SeekGE { is_index: _, cursor_id, start_reg, - num_regs: _, + num_regs, target_pc, } | Insn::SeekLE { is_index: _, cursor_id, start_reg, - num_regs: _, + num_regs, target_pc, } | Insn::SeekLT { is_index: _, cursor_id, start_reg, - num_regs: _, + num_regs, target_pc, } => ( match insn { @@ -784,7 +784,7 @@ pub fn insn_to_str( *start_reg as i32, OwnedValue::build_text(""), 0, - "".to_string(), + format!("key=[{}..{}]", start_reg, start_reg + num_regs - 1), ), Insn::SeekEnd { cursor_id } => ( "SeekEnd", @@ -822,58 +822,40 @@ pub fn insn_to_str( Insn::IdxGT { cursor_id, start_reg, - num_regs: _, + num_regs, target_pc, - } => ( - "IdxGT", - *cursor_id as i32, - target_pc.to_debug_int(), - *start_reg as i32, - OwnedValue::build_text(""), - 0, - "".to_string(), - ), - Insn::IdxGE { + } + | Insn::IdxGE { cursor_id, start_reg, - num_regs: _, + num_regs, target_pc, - } => ( - "IdxGE", - *cursor_id as i32, - target_pc.to_debug_int(), - *start_reg as i32, - OwnedValue::build_text(""), - 0, - "".to_string(), - ), - Insn::IdxLT { + } + | Insn::IdxLE { cursor_id, start_reg, - num_regs: _, + num_regs, target_pc, - } => ( - "IdxLT", - *cursor_id as i32, - target_pc.to_debug_int(), - *start_reg as i32, - OwnedValue::build_text(""), - 0, - "".to_string(), - ), - Insn::IdxLE { + } + | Insn::IdxLT { cursor_id, start_reg, - num_regs: _, + num_regs, target_pc, } => ( - "IdxLE", + match insn { + Insn::IdxGT { .. } => "IdxGT", + Insn::IdxGE { .. } => "IdxGE", + Insn::IdxLE { .. } => "IdxLE", + Insn::IdxLT { .. } => "IdxLT", + _ => unreachable!(), + }, *cursor_id as i32, target_pc.to_debug_int(), *start_reg as i32, OwnedValue::build_text(""), 0, - "".to_string(), + format!("key=[{}..{}]", start_reg, start_reg + num_regs - 1), ), Insn::DecrJumpZero { reg, target_pc } => ( "DecrJumpZero",