Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DefaultDiagnosticsContext should cache resultSetFetchedRows #14191

Closed
lukaseder opened this issue Nov 9, 2022 · 2 comments
Closed

DefaultDiagnosticsContext should cache resultSetFetchedRows #14191

lukaseder opened this issue Nov 9, 2022 · 2 comments

Comments

@lukaseder
Copy link
Member

The logic in DefaultDiagnosticsContext::resultSetFetchedRows alters the underlying ResultSet in order to calculate the actual fetched rows:

    public final int resultSetFetchedRows() {
        if (resultSet == null)
            return -1;

        try {
            if (resultSetClosing || resultSet.getType() != ResultSet.TYPE_FORWARD_ONLY) {
                while (resultSet.next())
                    resultSetFetchedRows++;

                resultSet.absolute(resultSetConsumedRows);
            }
        }
        catch (SQLException ignore) {}

        return resultSetFetchedRows;
    }

This means that one DiagnosticsListener querying this value might affect the result of this method for other listeners later on.

@lukaseder
Copy link
Member Author

This was discovered as the LoggingDiagnosticsListener created a regression: #14146

@lukaseder
Copy link
Member Author

Fixed in jOOQ 3.18.0, 3.17.6 (#14192), and 3.16.12 (#14193)

3.18 Diagnostics automation moved this from To do to Done Nov 9, 2022
lukaseder added a commit that referenced this issue Nov 9, 2022
lukaseder added a commit that referenced this issue Nov 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

1 participant