func (c *ClientConn) executeInNode(conn *backend.BackendConn, sql string, args []interface{}) ([]*mysql.Result, error) { var state string startTime := time.Now().UnixNano() r, err := conn.Execute(sql, args...) if err != nil { state = "ERROR" } else { state = "OK" } execTime := float64(time.Now().UnixNano()-startTime) / float64(time.Millisecond) if strings.ToLower(c.proxy.logSql[c.proxy.logSqlIndex]) != golog.LogSqlOff && execTime > float64(c.proxy.slowLogTime[c.proxy.slowLogTimeIndex]) { c.proxy.counter.IncrSlowLogTotal() golog.OutputSql(state, "%.1fms - %s->%s:%s", execTime, c.c.RemoteAddr(), conn.GetAddr(), sql, ) } if err != nil { return nil, err } return []*mysql.Result{r}, err }
func (c *ClientConn) executeInNode(conn *backend.BackendConn, sql string, args []interface{}) ([]*mysql.Result, error) { var state string r, err := conn.Execute(sql, args...) if err != nil { state = "ERROR" } else { state = "INFO" } if strings.ToLower(c.proxy.cfg.LogSql) != golog.LogSqlOff { golog.OutputSql(state, "%s->%s:%s", c.c.RemoteAddr(), conn.GetAddr(), sql, ) } if err != nil { return nil, err } return []*mysql.Result{r}, err }