On Thu, 29 Oct 2026 21:58:22 GMT, Justin Lu <[email protected]> wrote:

> Within `writeData`, an insert statement is being created for every inserted 
> row. This is redundant because the insertion statement remains the same 
> between inserted rows. (i.e., all columns are included and the values are 
> supplied in `insertNewRow`). What is problematic is that the final insert 
> statement is the only one being closed. Additionally, if the code throws an 
> exception, then this final insert statement does not get closed as well.
> 
> This PR
> - Ensures the statement is created only once (and closed)
> - Ensures that if the code throws an exception, the statement is still 
> closed. And in the case where both the original code and closing would throw 
> an exception, the suppressed exception is attached.
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

This pull request has now been integrated.

Changeset: 9ad40e6e
Author:    Justin Lu <[email protected]>
URL:       
https://git.openjdk.org/jdk/commit/9ad40e6e0938b679ecbf83fc3b639829c1306000
Stats:     106 lines in 1 file changed: 39 ins; 24 del; 43 mod

8395714: Excessive PreparedStatement creation in CachedRowSetWriter

Reviewed-by: lancea

-------------

PR: https://git.openjdk.org/jdk/pull/33639

Reply via email to