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

Method QueryContext

connection.go:634–651  ·  view source on GitHub ↗
(ctx context.Context, query string, args []driver.NamedValue)

Source from the content-addressed store, hash-verified

632}
633
634func (mc *mysqlConn) QueryContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Rows, error) {
635 dargs, err := namedValueToValue(args)
636 if err != nil {
637 return nil, err
638 }
639
640 if err := mc.watchCancel(ctx); err != nil {
641 return nil, err
642 }
643
644 rows, err := mc.query(query, dargs)
645 if err != nil {
646 mc.finish()
647 return nil, err
648 }
649 rows.finish = mc.finish
650 return rows, err
651}
652
653func (mc *mysqlConn) ExecContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Result, error) {
654 dargs, err := namedValueToValue(args)

Callers 4

TestContextCancelQueryFunction · 0.45

Calls 4

watchCancelMethod · 0.95
queryMethod · 0.95
finishMethod · 0.95
namedValueToValueFunction · 0.85

Tested by 4

TestContextCancelQueryFunction · 0.36