From 481b622e3b5d754c9ee10f7547978e17f5b17303 Mon Sep 17 00:00:00 2001 From: amell <18292835608@163.com> Date: Sat, 17 Jun 2023 16:57:06 +0800 Subject: [PATCH] =?UTF-8?q?[fix]=20https://gitee.com/objs/mayfly-go/issues?= =?UTF-8?q?/I7E8ZF=E7=9A=84=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/internal/db/application/db_sql_exec.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/server/internal/db/application/db_sql_exec.go b/server/internal/db/application/db_sql_exec.go index ad38f4c0..bc09e89e 100644 --- a/server/internal/db/application/db_sql_exec.go +++ b/server/internal/db/application/db_sql_exec.go @@ -193,6 +193,7 @@ func doUpdate(update *sqlparser.Update, execSqlReq *DbSqlExecReq, dbSqlExec *ent // 可能使用别名,故空格切割 tableName := strings.Split(tableStr, " ")[0] where := sqlparser.String(update.Where) + biz.IsTrue(len(where) > 0, "SQL[%s]未执行. 请完善 where 条件后再执行", execSqlReq.Sql) updateExprs := update.Exprs updateColumns := make([]string, 0) @@ -227,6 +228,7 @@ func doDelete(delete *sqlparser.Delete, execSqlReq *DbSqlExecReq, dbSqlExec *ent // 可能使用别名,故空格切割 table := strings.Split(tableStr, " ")[0] where := sqlparser.String(delete.Where) + biz.IsTrue(len(where) > 0, "SQL[%s]未执行. 请完善 where 条件后再执行", execSqlReq.Sql) // 查询删除数据 selectSql := fmt.Sprintf("SELECT * FROM %s %s LIMIT 200", tableStr, where)