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
WIP: fix: revert batch executions that silently accept select statements #983
Conversation
Codecov Report
@@ Coverage Diff @@
## master #983 +/- ##
=========================================
Coverage 65.94% 65.94%
- Complexity 3562 3563 +1
=========================================
Files 166 166
Lines 15244 15244
Branches 2465 2465
=========================================
Hits 10053 10053
Misses 4022 4022
Partials 1169 1169 |
updateCounts[2] == 1 || updateCounts[2] == Statement.SUCCESS_NO_INFO); | ||
try { | ||
stmt.executeBatch(); | ||
Assert.fail("Should raise a BatchUpdateException because of the SELECT"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add explicit reference that clarifies why "select should raise BatchUpdateException"
int[] updateCounts = e.getUpdateCounts(); | ||
// There are 3 batches | ||
Assert.assertEquals(3, updateCounts.length); | ||
Assert.assertEquals(Statement.EXECUTE_FAILED, updateCounts[0]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All the contents of resulting array should be verified, not just the first element
Assert.assertEquals(3, updateCounts.length); | ||
Assert.assertEquals(Statement.EXECUTE_FAILED, updateCounts[0]); | ||
} catch (SQLException e) { | ||
Assert.fail("Should throw a BatchUpdateException instead of a generic SQLException: " + e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please avoid +e
pattern, and add reference to the spec.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, this was just a quick copy/revert of the method. I need to verify the correct behavior.
Fixes #970