[#7097] Avoid consuming result sets that aren't being closed or scrollable
This commit is contained in:
parent
c8812d0bc3
commit
8f96a58c7d
@ -51,6 +51,7 @@ import org.jooq.DiagnosticsContext;
|
||||
final class DefaultDiagnosticsContext implements DiagnosticsContext {
|
||||
|
||||
ResultSet resultSet;
|
||||
boolean resultSetClosing;
|
||||
int resultSetFetchedColumns;
|
||||
int resultSetActualColumns;
|
||||
int resultSetFetchedRows;
|
||||
@ -90,12 +91,15 @@ final class DefaultDiagnosticsContext implements DiagnosticsContext {
|
||||
return -1;
|
||||
|
||||
try {
|
||||
while (resultSet.next())
|
||||
resultSetActualRows++;
|
||||
if (resultSetClosing || resultSet.getType() != ResultSet.TYPE_FORWARD_ONLY) {
|
||||
while (resultSet.next())
|
||||
resultSetActualRows++;
|
||||
|
||||
resultSet.absolute(resultSetFetchedRows);
|
||||
resultSet.absolute(resultSetFetchedRows);
|
||||
}
|
||||
}
|
||||
catch (SQLException ignore) {}
|
||||
|
||||
return resultSetActualRows;
|
||||
}
|
||||
|
||||
|
||||
@ -745,6 +745,7 @@ final class DiagnosticsResultSet extends DefaultResultSet {
|
||||
super.absolute(current = rows);
|
||||
|
||||
DefaultDiagnosticsContext ctx = ctx();
|
||||
ctx.resultSetClosing = true;
|
||||
|
||||
if (super.next())
|
||||
connection.listeners.tooManyRowsFetched(ctx);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user