mirror of
https://github.com/aljazceru/turso.git
synced 2026-01-05 09:14:24 +01:00
Add consumeAll method in LimboResultSet and let JDBC4Statement to use it
This commit is contained in:
@@ -39,6 +39,19 @@ public class LimboResultSet {
|
||||
this.statement = statement;
|
||||
}
|
||||
|
||||
/**
|
||||
* Consumes all the rows in this result set until the {@link #next()} method returns `false`.
|
||||
*
|
||||
* @throws SQLException if the result set is not open or if an error occurs while iterating.
|
||||
*/
|
||||
public void consumeAll() throws SQLException {
|
||||
if (!open) {
|
||||
throw new SQLException("The result set is not open");
|
||||
}
|
||||
|
||||
while (next()) {}
|
||||
}
|
||||
|
||||
/**
|
||||
* Moves the cursor forward one row from its current position. A {@link LimboResultSet} cursor is
|
||||
* initially positioned before the first fow; the first call to the method <code>next</code> makes
|
||||
@@ -74,9 +87,6 @@ public class LimboResultSet {
|
||||
}
|
||||
|
||||
pastLastRow = lastStepResult.isDone();
|
||||
if (pastLastRow) {
|
||||
open = false;
|
||||
}
|
||||
return !pastLastRow;
|
||||
}
|
||||
|
||||
|
||||
@@ -65,9 +65,7 @@ public class JDBC4Statement implements Statement {
|
||||
|
||||
requireNonNull(statement, "statement should not be null after running execute method");
|
||||
final LimboResultSet resultSet = statement.getResultSet();
|
||||
while (resultSet.isOpen()) {
|
||||
resultSet.next();
|
||||
}
|
||||
resultSet.consumeAll();
|
||||
|
||||
// TODO: return update count;
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user