You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Medium Risk
Changes JDBC Statement/PreparedStatement execution behavior around whether a query is considered to return a ResultSet, which can affect client control flow and error handling for edge-case SQL parsing outcomes.
Overview
Fixes handling of SQL parsed as UNKNOWN by treating it as result-set capable in the SQL parser, so Statement.execute(...)/PreparedStatement.execute() can still expose a ResultSet when the server returns one.
Tightens JDBC execution semantics by returning false when executeQueryImpl(...) yields no schema/result set and by throwing in Statement.executeQuery(...) when no ResultSet is produced; adds integration tests covering UNKNOWN (malformed/odd) SELECTs and adjusts DatabaseMetaData expectations for UInt128 to report Types.NUMERIC.
Written by Cursor Bugbot for commit 857cbea. This will update automatically on new commits. Configure here.
throw new SQLException("Called method expects empty or filled result set but query has returned none. Consider using `java.sql.Statement.execute(java.lang.String)`", ExceptionUtils.SQL_STATE_CLIENT_ERROR);
onResultSetClosed(null); // no more result sets left - close statement.
The reason will be displayed to describe this comment to others. Learn more.
Response resource leak when reader has no schema
High Severity
When reader.getSchema() is null, the new code closes the reader and returns null, but the response object (obtained at line 174/176) is never closed. Previously, the code threw a SQLException which was caught by the catch block at line 190, which properly closed the response. Now the early return null bypasses the catch block, leaking the HTTP response/connection resource.
The reason will be displayed to describe this comment to others. Learn more.
ANTLR4 parser missing UNKNOWN result set handling
Medium Severity
The fix for UNKNOWN statements only applies to the JavaCC parser's isStmtWithResultSet. The ANTLR4 parser's equivalent isStmtWithResultSet (line 212) checks parse tree structure and does not treat error/unknown statements as having a result set. When the ANTLR4 parser is selected, truly unrecognizable SQL with results will still be routed to executeUpdateImpl instead of executeQueryImpl, leaving the original bug unfixed for ANTLR4 users.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes: #2784
Checklist
Delete items not relevant to your PR:
Note
Medium Risk
Changes JDBC
Statement/PreparedStatementexecution behavior around whether a query is considered to return aResultSet, which can affect client control flow and error handling for edge-case SQL parsing outcomes.Overview
Fixes handling of SQL parsed as
UNKNOWNby treating it as result-set capable in the SQL parser, soStatement.execute(...)/PreparedStatement.execute()can still expose aResultSetwhen the server returns one.Tightens JDBC execution semantics by returning
falsewhenexecuteQueryImpl(...)yields no schema/result set and by throwing inStatement.executeQuery(...)when noResultSetis produced; adds integration tests coveringUNKNOWN(malformed/odd) SELECTs and adjustsDatabaseMetaDataexpectations forUInt128to reportTypes.NUMERIC.Written by Cursor Bugbot for commit 857cbea. This will update automatically on new commits. Configure here.