fix PG的重复设置事务等级的bug
This commit is contained in:
parent
47a83330e6
commit
d6cb2e14fb
@ -764,13 +764,18 @@ public abstract class AbstractSQLExecutor implements SQLExecutor {
|
||||
}
|
||||
|
||||
@Override
|
||||
private boolean setIsolationStatus = false; //设置事务等级
|
||||
public void begin(int transactionIsolation) throws SQLException {
|
||||
Log.d("\n\n" + TAG, "<<<<<<<<<<<<<< TRANSACTION begin transactionIsolation = " + transactionIsolation + " >>>>>>>>>>>>>>>>>>>>>>> \n\n");
|
||||
//不做判断,如果掩盖了问题,调用层都不知道为啥事务没有提交成功
|
||||
// if (connection == null || connection.isClosed()) {
|
||||
// return;
|
||||
// }
|
||||
connection.setTransactionIsolation(transactionIsolation);
|
||||
connection.setAutoCommit(false);
|
||||
if(! this.setIsolationStatus){ //只设置一次Isolation等级 PG重复设置事务等级会报错
|
||||
connection.setTransactionIsolation(transactionIsolation);
|
||||
}
|
||||
this.setIsolationStatus=true;
|
||||
connection.setAutoCommit(false); //java.sql.SQLException: Can''t call commit when autocommit=true
|
||||
}
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user