Add statement interruption support

This adds an interrupt() method to Statement that allows apps to
interrupt a running statement. Please note that this is different from
`sqlite3_interrupt()` which interrupts all ongoing operations in a
database. Although we want to support that too, per statement interrupt
is much more useful to apps.
This commit is contained in:
Pekka Enberg
2024-12-19 11:41:07 +02:00
parent 69e3dd28f7
commit e93ac38e55
10 changed files with 56 additions and 1 deletions

View File

@@ -134,6 +134,9 @@ impl Cursor {
PyErr::new::<OperationalError, _>(format!("IO error: {:?}", e))
})?;
}
limbo_core::RowResult::Interrupt => {
return Ok(None);
}
limbo_core::RowResult::Done => {
return Ok(None);
}
@@ -165,6 +168,9 @@ impl Cursor {
PyErr::new::<OperationalError, _>(format!("IO error: {:?}", e))
})?;
}
limbo_core::RowResult::Interrupt => {
return Ok(results);
}
limbo_core::RowResult::Done => {
return Ok(results);
}