diff --git a/bindings/python/src/lib.rs b/bindings/python/src/lib.rs index 764fcfcf5..d69ae3b8f 100644 --- a/bindings/python/src/lib.rs +++ b/bindings/python/src/lib.rs @@ -101,17 +101,16 @@ impl Cursor { // For DDL and DML statements, // we need to execute the statement immediately if stmt_is_ddl || stmt_is_dml { - loop { - match stmt.borrow_mut().step().map_err(|e| { - PyErr::new::(format!("Step error: {:?}", e)) - })? { - limbo_core::StepResult::IO => { - self.conn.io.run_once().map_err(|e| { - PyErr::new::(format!("IO error: {:?}", e)) - })?; - } - _ => break, - } + while stmt + .borrow_mut() + .step() + .map_err(|e| PyErr::new::(format!("Step error: {:?}", e)))? + .eq(&limbo_core::StepResult::IO) + { + self.conn + .io + .run_once() + .map_err(|e| PyErr::new::(format!("IO error: {:?}", e)))?; } } diff --git a/core/lib.rs b/core/lib.rs index 7a00b47ee..ff36c328c 100644 --- a/core/lib.rs +++ b/core/lib.rs @@ -474,6 +474,7 @@ impl Statement { } } +#[derive(PartialEq)] pub enum StepResult<'a> { Row(Row<'a>), IO, @@ -482,6 +483,7 @@ pub enum StepResult<'a> { Busy, } +#[derive(PartialEq)] pub struct Row<'a> { pub values: Vec>, }