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: when use Statement.executeBatch() api can not generate after … #4838

Merged
merged 7 commits into from
Aug 6, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,18 @@ protected T executeAutoCommitFalse(Object[] args) throws Exception {
}
TableRecords beforeImage = beforeImage();
T result = statementCallback.execute(statementProxy.getTargetStatement(), args);
int updateCount = statementProxy.getUpdateCount();
if (updateCount > 0) {
if (needUndoLog()) {
TableRecords afterImage = afterImage(beforeImage);
prepareUndoLog(beforeImage, afterImage);
}
return result;
}

protected boolean needUndoLog() throws Exception {
Copy link
Contributor

Choose a reason for hiding this comment

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

SQLexception

int updateCount = statementProxy.getUpdateCount();
return updateCount > 0;
}

private boolean isMultiPk() {
if (null != sqlRecognizer) {
return getTableMeta().getPrimaryKeyOnlyName().size() > 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@ else if (containsColumns()) {
return pkValuesMap;
}

@Override
protected boolean needUndoLog() throws Exception {
return true;
}

/**
* the modify for test
*/
Expand Down