fix database error

master
兔子 6 years ago
parent 941d54b886
commit dbdb0de0f3

@ -780,6 +780,8 @@ func FetchAll(rows *sql.Rows) (error, map[int]map[string]string) {
switch vtype := col.(type) {
case int64:
record[columns[i]] = strconv.FormatInt(vtype, 10)
case string:
record[columns[i]] = vtype
default:
record[columns[i]] = string(vtype.([]byte))
}
@ -793,6 +795,10 @@ func FetchAll(rows *sql.Rows) (error, map[int]map[string]string) {
func OpenDB(Method, ConnStr string) error {
var err error
DBRes, err = sql.Open(Method, ConnStr)
if err != nil {
return err
}
err = DBRes.Ping()
return err
}
func CloseDB() {

Loading…
Cancel
Save