core: Unify Row and Record structs

They're exactly the same thing.
This commit is contained in:
Pekka Enberg
2025-02-05 09:02:56 +02:00
parent 20ffcb9d48
commit 7573fc62e6
2 changed files with 13 additions and 15 deletions

View File

@@ -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::<OperationalError, _>(format!("Step error: {:?}", e)))?
.eq(&limbo_core::StepResult::IO)
{
self.conn
.io
.run_once()
.map_err(|e| PyErr::new::<OperationalError, _>(format!("IO error: {:?}", e)))?;
loop {
match stmt.borrow_mut().step().map_err(|e| {
PyErr::new::<OperationalError, _>(format!("Step error: {:?}", e))
})? {
limbo_core::StepResult::IO => {
self.conn.io.run_once().map_err(|e| {
PyErr::new::<OperationalError, _>(format!("IO error: {:?}", e))
})?;
}
_ => break,
}
}
}

View File

@@ -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<Value<'a>>,
}
pub type Row<'a> = types::Record<'a>;
impl<'a> Row<'a> {
pub fn get<T: types::FromValue<'a> + 'a>(&self, idx: usize) -> Result<T> {