MCPcopy
hub / github.com/go-sql-driver/mysql / BenchmarkQueryContext

Function BenchmarkQueryContext

benchmark_test.go:282–295  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

280}
281
282func BenchmarkQueryContext(b *testing.B) {
283 db := initDB(b, false,
284 "DROP TABLE IF EXISTS foo",
285 "CREATE TABLE foo (id INT PRIMARY KEY, val CHAR(50))",
286 `INSERT INTO foo VALUES (1, "one")`,
287 `INSERT INTO foo VALUES (2, "two")`,
288 )
289 defer db.Close()
290 for _, p := range []int{1, 2, 3, 4} {
291 b.Run(fmt.Sprintf("%d", p), func(b *testing.B) {
292 benchmarkQueryContext(b, db, p)
293 })
294 }
295}
296
297func benchmarkExecContext(b *testing.B, db *sql.DB, p int) {
298 ctx, cancel := context.WithCancel(context.Background())

Callers

nothing calls this directly

Calls 3

initDBFunction · 0.85
benchmarkQueryContextFunction · 0.85
CloseMethod · 0.45

Tested by

no test coverage detected