[ Agent ] [ App ] - fix mysql init bugs - 7
This commit is contained in:
@@ -49,9 +49,13 @@ func MysqlSqlFileLoad(jackeyLoveIp string, jackeyLoveFileList []string) (bool, [
|
|||||||
if sqlStatement == "" || sqlStatement[:2] == "--" || sqlStatement[:2] == "/*" {
|
if sqlStatement == "" || sqlStatement[:2] == "--" || sqlStatement[:2] == "/*" {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
// 执行 SQL 语句
|
|
||||||
query += sqlStatement + " "
|
query += sqlStatement
|
||||||
if strings.Contains(sqlStatement, ";") {
|
|
||||||
|
if strings.HasSuffix(strings.TrimSpace(sqlStatement), ";") {
|
||||||
|
|
||||||
|
fmt.Printf("%s -> %s", jackeyLoveFile, query)
|
||||||
|
|
||||||
_, err := db.Exec(query)
|
_, err := db.Exec(query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
executeError := fmt.Sprintf("[MysqlSqlFileLoad] - jackeyLoveFile %s 执行出错: %s, 错误信息: %s", jackeyLove.Name(), sqlStatement, err.Error())
|
executeError := fmt.Sprintf("[MysqlSqlFileLoad] - jackeyLoveFile %s 执行出错: %s, 错误信息: %s", jackeyLove.Name(), sqlStatement, err.Error())
|
||||||
@@ -60,10 +64,10 @@ func MysqlSqlFileLoad(jackeyLoveIp string, jackeyLoveFileList []string) (bool, [
|
|||||||
executeError,
|
executeError,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// reset
|
|
||||||
query = ""
|
query = ""
|
||||||
|
} else {
|
||||||
|
query += " " // 添加空格以便连接多行语句
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检查扫描过程中是否有错误
|
// 检查扫描过程中是否有错误
|
||||||
|
|||||||
Reference in New Issue
Block a user