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

WIP: fix: revert batch executions that silently accept select statements #983

Closed
wants to merge 1 commit into from

Conversation

jorsol
Copy link
Member

@jorsol jorsol commented Oct 6, 2017

Fixes #970

@codecov-io
Copy link

Codecov Report

Merging #983 into master will not change coverage.
The diff coverage is 100%.

@@            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");
Copy link
Member

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]);
Copy link
Member

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);
Copy link
Member

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.

Copy link
Member Author

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.

@jorsol jorsol changed the title fix: revert batch executions that silently accept select statements WIP: fix: revert batch executions that silently accept select statements Oct 11, 2017
@jorsol jorsol closed this Oct 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants