mirror of
https://github.com/CodePhiliaX/Chat2DB.git
synced 2025-07-30 19:22:58 +08:00
update sql error
This commit is contained in:
@ -134,6 +134,8 @@ public class MysqlDBManage extends DefaultDBManage implements DBManage {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
connection.rollback();
|
connection.rollback();
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
|
}finally {
|
||||||
|
connection.setAutoCommit(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -100,13 +100,13 @@ public class DlTemplateServiceImpl implements DlTemplateService {
|
|||||||
List<String> sqlList = SqlUtils.parse(param.getSql(), dbType);
|
List<String> sqlList = SqlUtils.parse(param.getSql(), dbType);
|
||||||
Connection connection = Chat2DBContext.getConnection();
|
Connection connection = Chat2DBContext.getConnection();
|
||||||
try {
|
try {
|
||||||
connection.setAutoCommit(false);
|
// connection.setAutoCommit(false);
|
||||||
for (String originalSql : sqlList) {
|
for (String originalSql : sqlList) {
|
||||||
ExecuteResult executeResult = executor.executeUpdate(originalSql, connection, 1);
|
ExecuteResult executeResult = executor.executeUpdate(originalSql, connection, 1);
|
||||||
dataResult.setData(executeResult);
|
dataResult.setData(executeResult);
|
||||||
addOperationLog(executeResult);
|
addOperationLog(executeResult);
|
||||||
}
|
}
|
||||||
connection.commit();
|
// connection.commit();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("executeUpdate error", e);
|
log.error("executeUpdate error", e);
|
||||||
dataResult.setSuccess(false);
|
dataResult.setSuccess(false);
|
||||||
|
Reference in New Issue
Block a user