From 7573fc62e60d39f81f536edd8009ae0d4422edb2 Mon Sep 17 00:00:00 2001 From: Pekka Enberg Date: Wed, 5 Feb 2025 09:02:56 +0200 Subject: [PATCH] core: Unify Row and Record structs They're exactly the same thing. --- bindings/python/src/lib.rs | 21 +++++++++++---------- core/lib.rs | 7 ++----- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/bindings/python/src/lib.rs b/bindings/python/src/lib.rs index 085d71b3b..16afc5494 100644 --- a/bindings/python/src/lib.rs +++ b/bindings/python/src/lib.rs @@ -101,16 +101,17 @@ impl Cursor { // For DDL and DML statements, // we need to execute the statement immediately if stmt_is_ddl || stmt_is_dml { - 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)))?; + 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, + } } } diff --git a/core/lib.rs b/core/lib.rs index d02312dbc..73afafb29 100644 --- a/core/lib.rs +++ b/core/lib.rs @@ -498,7 +498,7 @@ impl Statement { } } -#[derive(Debug, PartialEq)] +#[derive(Debug)] pub enum StepResult<'a> { Row(Row<'a>), IO, @@ -507,10 +507,7 @@ pub enum StepResult<'a> { Busy, } -#[derive(Debug, PartialEq)] -pub struct Row<'a> { - pub values: Vec>, -} +pub type Row<'a> = types::Record<'a>; impl<'a> Row<'a> { pub fn get + 'a>(&self, idx: usize) -> Result {