本文整理匯總了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
}