diff --git a/starainrt.go b/starainrt.go index 6d1d069..ebf7750 100644 --- a/starainrt.go +++ b/starainrt.go @@ -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() {