|
|
|
@ -543,13 +543,14 @@ func (db *DB) Query(req *command.Request, xTime bool) ([]*command.QueryRows, err
|
|
|
|
|
return db.queryWithConn(req, xTime, conn)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (db *DB) queryWithConn(req *command.Request, xTime bool, conn *sql.Conn) ([]*command.QueryRows, error) {
|
|
|
|
|
var err error
|
|
|
|
|
type Queryer interface {
|
|
|
|
|
type queryer interface {
|
|
|
|
|
QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var queryer Queryer
|
|
|
|
|
func (db *DB) queryWithConn(req *command.Request, xTime bool, conn *sql.Conn) ([]*command.QueryRows, error) {
|
|
|
|
|
var err error
|
|
|
|
|
|
|
|
|
|
var queryer queryer
|
|
|
|
|
var tx *sql.Tx
|
|
|
|
|
if req.Transaction {
|
|
|
|
|
stats.Add(numQTx, 1)
|
|
|
|
@ -621,10 +622,6 @@ func (db *DB) queryWithConn(req *command.Request, xTime bool, conn *sql.Conn) ([
|
|
|
|
|
return allRows, err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type queryer interface {
|
|
|
|
|
QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (db *DB) queryStmtWithConn(stmt *command.Statement, xTime bool, q queryer) (*command.QueryRows, error) {
|
|
|
|
|
rows := &command.QueryRows{}
|
|
|
|
|
start := time.Now()
|
|
|
|
|