Skip to content

Clear Statement warnings in ScriptUtils.executeSqlScript() #27084

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

Closed
wants to merge 1 commit into from
Closed

Conversation

lfz757077613
Copy link

executeSqlScript use only one Statement to execute sql, so the getWarnings of Statement will contains pre warning

Ps: Maybe creating new Statement for every sql is better

executeSqlScript use only one Statement to execute sql, so the getWarnings of Statement will contains pre warning
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Jun 20, 2021
@sbrannen
Copy link
Member

Hi @lfz757077613,

Thanks for submitting your first pull request for the Spring Framework.

According to the Javadoc for java.sql.Statement.getWarnings():

The warning chain is automatically cleared each time a statement is (re)executed.

Do you have a particular use case you can share with us where the warning chain does not get properly cleared automatically between execute() invocations in ScriptUtils?

@sbrannen sbrannen added in: data Issues in data modules (jdbc, orm, oxm, tx) status: waiting-for-feedback We need additional information before we can continue labels Jun 20, 2021
@sbrannen sbrannen changed the title clearWarnings in executeSqlScript of ScriptUtils Clear Statement warnings in ScriptUtils.executeSqlScript() Jun 20, 2021
@lfz757077613
Copy link
Author

lfz757077613 commented Jun 21, 2021

I see "The warning chain is automatically cleared each time a statement is (re)executed." in doc.
Even through I use hikari, but it call StatementImpl directly. I guess StatementImpl of mysql driver has a bug or the JavaDoc is wrong
image

demo.zip

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Jun 21, 2021
@snicoll
Copy link
Member

snicoll commented Aug 26, 2023

StatementImpl of mysql driver has a bug

That's my understanding yes. I haven't found a bug or something on the forum that talks about this. Can you please report the issue to the MySQL driver? Their contributing page provides link to their issue tracker and forum.

@snicoll snicoll closed this Aug 26, 2023
@snicoll snicoll added status: declined A suggestion or change that we don't feel we should currently apply and removed status: waiting-for-triage An issue we've not yet triaged or decided on status: feedback-provided Feedback has been provided labels Aug 26, 2023
@lfz757077613
Copy link
Author

I have reported it to mysql. Thanks for reply
https://bugs.mysql.com/bug.php?id=112195

@lfz757077613
Copy link
Author

I have reported it to mysql. Thanks for reply https://bugs.mysql.com/bug.php?id=112195

https://dev.mysql.com/doc/relnotes/connector-j/en/news-8-3-0.html
mysql-connector-j 8.3.0 fix it 😁

@bclozel
Copy link
Member

bclozel commented Jan 17, 2024

@sbrannen sbrannen changed the title Clear Statement warnings in ScriptUtils.executeSqlScript() Clear Statement warnings in ScriptUtils.executeSqlScript() Jan 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: data Issues in data modules (jdbc, orm, oxm, tx) status: declined A suggestion or change that we don't feel we should currently apply
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants