mirror of
https://github.com/aljazceru/turso.git
synced 2025-12-28 13:34:24 +01:00
Change LimboStatement.java to throw exception when the result is null which is the error case
This commit is contained in:
@@ -55,7 +55,11 @@ public class LimboResultSet {
|
||||
}
|
||||
|
||||
lastStepResult = this.statement.step();
|
||||
pastLastRow = lastStepResult == null || lastStepResult.isDone();
|
||||
if (lastStepResult.isRow()) {
|
||||
row++;
|
||||
}
|
||||
|
||||
pastLastRow = lastStepResult.isDone();
|
||||
return !pastLastRow;
|
||||
}
|
||||
|
||||
|
||||
@@ -38,9 +38,13 @@ public class LimboStatement {
|
||||
return resultSet.hasLastStepReturnedRow();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
LimboStepResult step() throws SQLException {
|
||||
return step(this.statementPointer);
|
||||
final LimboStepResult result = step(this.statementPointer);
|
||||
if (result == null) {
|
||||
throw new SQLException("step() returned null, which is only returned when an error occurs");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -44,8 +44,27 @@ public class LimboStepResult {
|
||||
@Override
|
||||
public String toString() {
|
||||
return "LimboStepResult{" +
|
||||
"stepResultId=" + stepResultId +
|
||||
"stepResultName=" + getStepResultName() +
|
||||
", result=" + Arrays.toString(result) +
|
||||
'}';
|
||||
}
|
||||
|
||||
private String getStepResultName() {
|
||||
switch (stepResultId) {
|
||||
case STEP_RESULT_ID_ROW:
|
||||
return "ROW";
|
||||
case STEP_RESULT_ID_IO:
|
||||
return "IO";
|
||||
case STEP_RESULT_ID_DONE:
|
||||
return "DONE";
|
||||
case STEP_RESULT_ID_INTERRUPT:
|
||||
return "INTERRUPT";
|
||||
case STEP_RESULT_ID_BUSY:
|
||||
return "BUSY";
|
||||
case STEP_RESULT_ID_ERROR:
|
||||
return "ERROR";
|
||||
default:
|
||||
return "UNKNOWN";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user