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

Method Exec

connection.go:433–455  ·  view source on GitHub ↗
(query string, args []driver.Value)

Source from the content-addressed store, hash-verified

431}
432
433func (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
458func (mc *mysqlConn) exec(query string) error {

Callers 1

ExecContextMethod · 0.95

Calls 3

interpolateParamsMethod · 0.95
execMethod · 0.95
markBadConnMethod · 0.95

Tested by

no test coverage detected