Skip to content
Snippets Groups Projects
Unverified Commit ce41bce9 authored by 陈健斌's avatar 陈健斌 Committed by GitHub
Browse files

bugfix: fix repeated commit when autocommit is false (#3040)

parent da0e25bd
No related branches found
No related tags found
No related merge requests found
......@@ -185,6 +185,9 @@ public class ConnectionProxy extends AbstractConnectionProxy {
return null;
});
} catch (SQLException e) {
if (targetConnection != null && !getAutoCommit()) {
rollback();
}
throw e;
} catch (Exception e) {
throw new SQLException(e);
......@@ -251,7 +254,7 @@ public class ConnectionProxy extends AbstractConnectionProxy {
@Override
public void setAutoCommit(boolean autoCommit) throws SQLException {
if (autoCommit && !getAutoCommit()) {
if ((context.inGlobalTransaction() || context.isGlobalLockRequire()) && autoCommit && !getAutoCommit()) {
// change autocommit from false to true, we should commit() first according to JDBC spec.
doCommit();
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment