syntactic changes: rewrite loop with while

This commit is contained in:
Jorge López 2025-01-18 18:47:02 +01:00
parent 07970468bd
commit e4ab2fb273
No known key found for this signature in database
GPG key ID: F8D6CEBC4788D6A1
2 changed files with 12 additions and 11 deletions

View file

@ -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::<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,
}
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)))?;
}
}