(b *testing.B)
| 226 | } |
| 227 | |
| 228 | func BenchmarkInterpolation(b *testing.B) { |
| 229 | mc := &mysqlConn{ |
| 230 | cfg: &Config{ |
| 231 | InterpolateParams: true, |
| 232 | Loc: time.UTC, |
| 233 | }, |
| 234 | maxAllowedPacket: maxPacketSize, |
| 235 | maxWriteSize: maxPacketSize - 1, |
| 236 | buf: newBuffer(), |
| 237 | } |
| 238 | |
| 239 | args := []driver.Value{ |
| 240 | int64(42424242), |
| 241 | float64(math.Pi), |
| 242 | false, |
| 243 | time.Unix(1423411542, 807015000), |
| 244 | []byte("bytes containing special chars ' \" \a \x00"), |
| 245 | "string containing special chars ' \" \a \x00", |
| 246 | } |
| 247 | q := "SELECT ?, ?, ?, ?, ?, ?" |
| 248 | |
| 249 | b.ReportAllocs() |
| 250 | |
| 251 | for b.Loop() { |
| 252 | _, err := mc.interpolateParams(q, args) |
| 253 | if err != nil { |
| 254 | b.Fatal(err) |
| 255 | } |
| 256 | } |
| 257 | } |
| 258 | |
| 259 | func benchmarkQueryContext(b *testing.B, db *sql.DB, p int) { |
| 260 | ctx, cancel := context.WithCancel(context.Background()) |
nothing calls this directly
no test coverage detected