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

bugfix: fix mysql through "select last_insert_id" get auto-increment failure #4310

Merged
merged 9 commits into from
Jan 21, 2022

Conversation

xiaochangbai
Copy link
Contributor

  • I have registered the PR changes.

Ⅰ. Describe what this PR did

mysql通过statementProxy.getGeneratedKeys()获取自增主键失败时进入catch逻辑中使用“SELECT LAST_INSERT_ID()”继续获取。当updateCount<=1时会在final逻辑中关闭rsFirstId,由于rsFirstId和genKeys引用的是同一个对象,所以genKeys也关闭了,此时再调用genKeys.next()就会报错:java.sql.SQLException: Operation not allowed after ResultSet closed

Ⅱ. Does this pull request fix one issue?

Ⅲ. Why don't you add test cases (unit test/integration test)?

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

@funky-eyes
Copy link
Contributor

此时再调用genKeys.next()就会报错 指的是哪?

@xiaochangbai
Copy link
Contributor Author

image

@lgtm-com
Copy link

lgtm-com bot commented Jan 18, 2022

This pull request fixes 1 alert when merging 2ec2098 into 11d3478 - view on LGTM.com

fixed alerts:

  • 1 for Potential database resource leak

@lgtm-com
Copy link

lgtm-com bot commented Jan 18, 2022

This pull request fixes 1 alert when merging 2d0437c into 11d3478 - view on LGTM.com

fixed alerts:

  • 1 for Potential database resource leak

@lgtm-com
Copy link

lgtm-com bot commented Jan 18, 2022

This pull request fixes 1 alert when merging 84972bc into 11d3478 - view on LGTM.com

fixed alerts:

  • 1 for Potential database resource leak

@lgtm-com
Copy link

lgtm-com bot commented Jan 18, 2022

This pull request fixes 1 alert when merging 18f10ef into 11d3478 - view on LGTM.com

fixed alerts:

  • 1 for Potential database resource leak

Copy link
Contributor

@funky-eyes funky-eyes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@jsbxyyx jsbxyyx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lgtm-com
Copy link

lgtm-com bot commented Jan 21, 2022

This pull request fixes 1 alert when merging cc89dea into 2c6e647 - view on LGTM.com

fixed alerts:

  • 1 for Potential database resource leak

@funky-eyes
Copy link
Contributor

image
改动的代码块进行code formatting

@xiaochangbai
Copy link
Contributor Author

OK,等下下班回去改一下

@codecov-commenter
Copy link

codecov-commenter commented Jan 21, 2022

Codecov Report

Merging #4310 (cf0a421) into develop (2c6e647) will increase coverage by 0.00%.
The diff coverage is 63.63%.

Impacted file tree graph

@@            Coverage Diff             @@
##             develop    #4310   +/-   ##
==========================================
  Coverage      48.52%   48.52%           
- Complexity      3798     3799    +1     
==========================================
  Files            725      725           
  Lines          24306    24310    +4     
  Branches        2984     2986    +2     
==========================================
+ Hits           11795    11797    +2     
- Misses         11261    11262    +1     
- Partials        1250     1251    +1     
Impacted Files Coverage Δ
.../rm/datasource/exec/mysql/MySQLInsertExecutor.java 69.14% <63.63%> (-0.86%) ⬇️

@xiaochangbai xiaochangbai changed the title bugfix: fix mysql get auto-increment failure bugfix: fix mysql through "select last_insert_id" get auto-increment failure Jan 21, 2022
@lgtm-com
Copy link

lgtm-com bot commented Jan 21, 2022

This pull request fixes 1 alert when merging cf0a421 into 2c6e647 - view on LGTM.com

fixed alerts:

  • 1 for Potential database resource leak

@funky-eyes funky-eyes added this to the 1.5.0 milestone Jan 21, 2022
@funky-eyes funky-eyes added module/rm-datasource rm-datasource module type: bug Category issues or prs related to bug. first-time contributor first-time contributor labels Jan 21, 2022
@funky-eyes funky-eyes merged commit 8563bf5 into apache:develop Jan 21, 2022
@xiaochangbai xiaochangbai deleted the fix-get-mysql-autoPK-bug branch January 28, 2022 06:16
Copy link
Member

@slievrly slievrly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
first-time contributor first-time contributor module/rm-datasource rm-datasource module type: bug Category issues or prs related to bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants