未验证 提交 0e9e6bee 编写于 作者: P plum-lihui 提交者: GitHub

Merge pull request #767 from taosdata/hotfix/tbase-1233

fix tbase-1233: go connector cause client crash
...@@ -118,14 +118,15 @@ func (rows *taosSqlRows) ColumnTypeScanType(i int) reflect.Type { ...@@ -118,14 +118,15 @@ func (rows *taosSqlRows) ColumnTypeScanType(i int) reflect.Type {
return rows.rs.columns[i].scanType() return rows.rs.columns[i].scanType()
} }
func (rows *taosSqlRows) Close() (err error) { func (rows *taosSqlRows) Close() error {
mc := rows.mc if rows.mc != nil {
if mc == nil { result := C.taos_use_result(rows.mc.taos)
return nil if result != nil {
C.taos_free_result(result)
}
rows.mc = nil
} }
return nil
rows.mc = nil
return err
} }
func (rows *taosSqlRows) HasNextResultSet() (b bool) { func (rows *taosSqlRows) HasNextResultSet() (b bool) {
......
...@@ -39,7 +39,7 @@ func (mc *taosConn) taosConnect(ip, user, pass, db string, port int) (taos unsaf ...@@ -39,7 +39,7 @@ func (mc *taosConn) taosConnect(ip, user, pass, db string, port int) (taos unsaf
defer C.free(unsafe.Pointer(cpass)) defer C.free(unsafe.Pointer(cpass))
defer C.free(unsafe.Pointer(cdb)) defer C.free(unsafe.Pointer(cdb))
taosObj := C.taos_connect(cip, cuser, cpass, cdb, (C.int)(port)) taosObj := C.taos_connect(cip, cuser, cpass, cdb, (C.ushort)(port))
if taosObj == nil { if taosObj == nil {
return nil, errors.New("taos_connect() fail!") return nil, errors.New("taos_connect() fail!")
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册