本文整理汇总了Golang中github.com/youtube/vitess/go/vt/dbconnpool.PoolConnection.Id方法的典型用法代码示例。如果您正苦于以下问题:Golang PoolConnection.Id方法的具体用法?Golang PoolConnection.Id怎么用?Golang PoolConnection.Id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/youtube/vitess/go/vt/dbconnpool.PoolConnection
的用法示例。
在下文中一共展示了PoolConnection.Id方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: execSQLNoPanic
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
}
示例2: executeSql
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
}