mirror of
https://github.com/tursodatabase/limbo.git
synced 2025-08-04 01:58:16 +00:00
Break the loop when step() returns Err
This commit is contained in:
parent
0481e69217
commit
53586b9d00
1 changed files with 7 additions and 8 deletions
|
@ -53,18 +53,17 @@ pub extern "system" fn Java_org_github_tursodatabase_core_LimboStatement_step<'l
|
|||
Ok(stmt) => stmt,
|
||||
Err(e) => {
|
||||
set_err_msg_and_throw_exception(&mut env, obj, LIMBO_ETC, e.to_string());
|
||||
|
||||
return JObject::null();
|
||||
return to_limbo_step_result(&mut env, STEP_RESULT_ID_ERROR, None);
|
||||
}
|
||||
};
|
||||
|
||||
loop {
|
||||
match stmt
|
||||
.stmt
|
||||
.step()
|
||||
.map_err(|_e| to_limbo_step_result(&mut env, STEP_RESULT_ID_ERROR, None))
|
||||
.unwrap()
|
||||
{
|
||||
let step_result = match stmt.stmt.step() {
|
||||
Ok(result) => result,
|
||||
Err(_) => return to_limbo_step_result(&mut env, STEP_RESULT_ID_ERROR, None),
|
||||
};
|
||||
|
||||
match step_result {
|
||||
StepResult::Row(row) => {
|
||||
return match row_to_obj_array(&mut env, &row) {
|
||||
Ok(row) => to_limbo_step_result(&mut env, STEP_RESULT_ID_ROW, Some(row)),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue