mirror of
https://gitee.com/dromara/mayfly-go
synced 2025-11-02 15:30:25 +08:00
Merge pull request #60 from kanzihuang/feature-export-databases
fix: 前端 DBMS->数据操作->新建查询,页面不显示查询结果
This commit is contained in:
@@ -174,9 +174,15 @@ func (d *Db) ExecSqlFile(rc *req.Ctx) {
|
||||
go func() {
|
||||
defer func() {
|
||||
if err := recover(); err != nil {
|
||||
var errInfo string
|
||||
switch t := err.(type) {
|
||||
case biz.BizError:
|
||||
errInfo = t.Error()
|
||||
case *biz.BizError:
|
||||
d.MsgApp.CreateAndSend(rc.LoginAccount, ws.ErrMsg("sql脚本执行失败", fmt.Sprintf("[%s]%s执行失败: [%s]", filename, dbConn.Info.GetLogDesc(), t.Error())))
|
||||
errInfo = t.Error()
|
||||
}
|
||||
if len(errInfo) > 0 {
|
||||
d.MsgApp.CreateAndSend(rc.LoginAccount, ws.ErrMsg("sql脚本执行失败", fmt.Sprintf("[%s]%s执行失败: [%s]", filename, dbConn.Info.GetLogDesc(), errInfo)))
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
@@ -302,7 +302,7 @@ func selectDataByDb(db *sql.DB, selectSql string) ([]string, []map[string]any, e
|
||||
err := walkTableRecord(db, selectSql, func(record map[string]any, columns []string) {
|
||||
result = append(result, record)
|
||||
if colNames == nil {
|
||||
colNames = make([]string, 0, len(columns))
|
||||
colNames = make([]string, len(columns))
|
||||
copy(colNames, columns)
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user