提交 db26cf1e 编写于 作者: L liu0x54

[TBASE-1047] Go connector prints all the SQL. This will harm the performance...

[TBASE-1047] Go connector prints all the SQL. This will harm the performance and consume unnecessary hard disk space. Modified to print only the SQLs which returns error.
上级 fcc308fb
...@@ -29,7 +29,7 @@ import ( ...@@ -29,7 +29,7 @@ import (
"unsafe" "unsafe"
) )
func (mc *taosConn) taosConnect(ip, user, pass, db string, port int) (taos unsafe.Pointer, err error){ func (mc *taosConn) taosConnect(ip, user, pass, db string, port int) (taos unsafe.Pointer, err error) {
cuser := C.CString(user) cuser := C.CString(user)
cpass := C.CString(pass) cpass := C.CString(pass)
cip := C.CString(ip) cip := C.CString(ip)
...@@ -48,7 +48,7 @@ func (mc *taosConn) taosConnect(ip, user, pass, db string, port int) (taos unsaf ...@@ -48,7 +48,7 @@ func (mc *taosConn) taosConnect(ip, user, pass, db string, port int) (taos unsaf
} }
func (mc *taosConn) taosQuery(sqlstr string) (int, error) { func (mc *taosConn) taosQuery(sqlstr string) (int, error) {
taosLog.Printf("taosQuery() input sql:%s\n", sqlstr) //taosLog.Printf("taosQuery() input sql:%s\n", sqlstr)
csqlstr := C.CString(sqlstr) csqlstr := C.CString(sqlstr)
defer C.free(unsafe.Pointer(csqlstr)) defer C.free(unsafe.Pointer(csqlstr))
...@@ -58,6 +58,7 @@ func (mc *taosConn) taosQuery(sqlstr string) (int, error) { ...@@ -58,6 +58,7 @@ func (mc *taosConn) taosQuery(sqlstr string) (int, error) {
mc.taos_error() mc.taos_error()
errStr := C.GoString(C.taos_errstr(mc.taos)) errStr := C.GoString(C.taos_errstr(mc.taos))
taosLog.Println("taos_query() failed:", errStr) taosLog.Println("taos_query() failed:", errStr)
taosLog.Printf("taosQuery() input sql:%s\n", sqlstr)
return 0, errors.New(errStr) return 0, errors.New(errStr)
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册