mirror of
https://github.com/aljazceru/turso.git
synced 2026-01-05 01:04:22 +01:00
Handle invalid step results
This commit is contained in:
@@ -64,6 +64,11 @@ public class LimboResultSet {
|
||||
row++;
|
||||
}
|
||||
|
||||
if (lastStepResult.isInInvalidState()) {
|
||||
open = false;
|
||||
throw new SQLException("step() returned invalid result: " + lastStepResult);
|
||||
}
|
||||
|
||||
pastLastRow = lastStepResult.isDone();
|
||||
if (pastLastRow) {
|
||||
open = false;
|
||||
|
||||
@@ -13,6 +13,7 @@ public class LimboStepResult {
|
||||
private static final int STEP_RESULT_ID_IO = 20;
|
||||
private static final int STEP_RESULT_ID_DONE = 30;
|
||||
private static final int STEP_RESULT_ID_INTERRUPT = 40;
|
||||
// Indicates that the database file could not be written because of concurrent activity by some other connection
|
||||
private static final int STEP_RESULT_ID_BUSY = 50;
|
||||
private static final int STEP_RESULT_ID_ERROR = 60;
|
||||
|
||||
@@ -41,6 +42,14 @@ public class LimboStepResult {
|
||||
return stepResultId == STEP_RESULT_ID_DONE;
|
||||
}
|
||||
|
||||
public boolean isInInvalidState() {
|
||||
// current implementation doesn't allow STEP_RESULT_ID_IO to be returned
|
||||
return stepResultId == STEP_RESULT_ID_IO ||
|
||||
stepResultId == STEP_RESULT_ID_INTERRUPT ||
|
||||
stepResultId == STEP_RESULT_ID_BUSY ||
|
||||
stepResultId == STEP_RESULT_ID_ERROR;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "LimboStepResult{" +
|
||||
|
||||
Reference in New Issue
Block a user