(query string, args []driver.Value)
| 431 | } |
| 432 | |
| 433 | func (mc *mysqlConn) Exec(query string, args []driver.Value) (driver.Result, error) { |
| 434 | if mc.closed.Load() { |
| 435 | return nil, driver.ErrBadConn |
| 436 | } |
| 437 | if len(args) != 0 { |
| 438 | if !mc.cfg.InterpolateParams { |
| 439 | return nil, driver.ErrSkip |
| 440 | } |
| 441 | // try to interpolate the parameters to save extra roundtrips for preparing and closing a statement |
| 442 | prepared, err := mc.interpolateParams(query, args) |
| 443 | if err != nil { |
| 444 | return nil, err |
| 445 | } |
| 446 | query = prepared |
| 447 | } |
| 448 | |
| 449 | err := mc.exec(query) |
| 450 | if err == nil { |
| 451 | copied := mc.result |
| 452 | return &copied, err |
| 453 | } |
| 454 | return nil, mc.markBadConn(err) |
| 455 | } |
| 456 | |
| 457 | // Internal function to execute commands |
| 458 | func (mc *mysqlConn) exec(query string) error { |
no test coverage detected