feat(ReverseEngine):提交小优化,准备下班,回家弄

This commit is contained in:
huangzj
2020-05-25 18:08:17 +08:00
parent a84341447a
commit e9502e1ac8
2 changed files with 26 additions and 2 deletions
+22
View File
@@ -3,6 +3,7 @@ package util
import (
"ReverseEngine/entity"
"database/sql"
"fmt"
"strings"
)
@@ -30,3 +31,24 @@ func FindColumnMessage(dbName string, tableName string, db *sql.DB) []entity.Col
return cms
}
func FindTableComment(dbName string, tableName string, db *sql.DB) string {
sql := fmt.Sprintf("select table_comment from information_schema.tables where table_schema = '%s' and table_name ='%s'", dbName, tableName)
row, err := db.Query(sql)
if err != nil {
panic("数据库查询出错:" + err.Error())
}
fmt.Println(row)
var s string
for row.Next() {
err := row.Scan(&s)
if err != nil {
panic("字段赋值错误了" + err.Error())
return ""
}
break
}
return s
}