File tree Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -116,6 +116,10 @@ type FileExecStatistic struct {
116
116
}
117
117
118
118
func (a FileExecStatistic ) FileExecStatus () string {
119
+ // 一旦存在执行失败的SQL,则执行失败
120
+ if a .FailedCount > 0 {
121
+ return SQLExecuteStatusFailed
122
+ }
119
123
// 手工执行后,手工执行和SQLE执行互斥,因此先判断
120
124
if a .ManuallyExecutedCount > 0 {
121
125
return SQLExecuteStatusManuallyExecuted
@@ -140,10 +144,7 @@ func (a FileExecStatistic) FileExecStatus() string {
140
144
// 若不包含初始化的SQL,但存在正在执行的SQL,则文件状态为执行中
141
145
return SQLExecuteStatusDoing
142
146
}
143
- // 执行完毕后
144
- if a .FailedCount > 0 {
145
- return SQLExecuteStatusFailed
146
- }
147
+ // 执行完毕后 程序执行到这里,其他所有状态数量均等于0,若存在成功的SQL,则执行成功
147
148
if a .SucceededCount > 0 {
148
149
return SQLExecuteStatusSucceeded
149
150
}
Original file line number Diff line number Diff line change @@ -569,6 +569,12 @@ func (a *action) executeSqlsGroupByBatchId(sqls []*model.ExecuteSQL) error {
569
569
if err := a .executeSQLBatch (sqlBatch ); err != nil {
570
570
return err
571
571
}
572
+ for _ , sqlInBatch := range sqlBatch {
573
+ if sqlInBatch .ExecStatus == model .SQLExecuteStatusFailed {
574
+ // 一旦出现执行失败的SQL,则不再执行其他未执行的SQL
575
+ return nil
576
+ }
577
+ }
572
578
// clear sql batch
573
579
sqlBatch = make ([]* model.ExecuteSQL , 0 )
574
580
}
You can’t perform that action at this time.
0 commit comments