func (rqc *RequestContext) execSQLNoPanic(conn dbconnpool.PoolConnection, sql string, wantfields bool) (*mproto.QueryResult, error) { if qd := rqc.qe.connKiller.SetDeadline(conn.Id(), rqc.deadline); qd != nil { defer qd.Done() } start := time.Now() result, err := conn.ExecuteFetch(sql, int(rqc.qe.maxResultSize.Get()), wantfields) rqc.logStats.AddRewrittenSql(sql, start) if err != nil { return nil, NewTabletErrorSql(FAIL, err) } return result, nil }
func (qe *QueryEngine) executeSql(logStats *SQLQueryStats, conn dbconnpool.PoolConnection, sql string, wantfields bool) (*mproto.QueryResult, error) { connid := conn.Id() qe.activePool.Put(connid) defer qe.activePool.Remove(connid) logStats.QuerySources |= QUERY_SOURCE_MYSQL logStats.NumberOfQueries++ logStats.AddRewrittenSql(sql) // NOTE(szopa): I am not doing this measurement inside // conn.ExecuteFetch because that would require changing the // PoolConnection interface. Same applies to executeStreamSql. fetchStart := time.Now() result, err := conn.ExecuteFetch(sql, int(qe.maxResultSize.Get()), wantfields) logStats.MysqlResponseTime += time.Now().Sub(fetchStart) if err != nil { return nil, NewTabletErrorSql(FAIL, err) } return result, nil }