ExecContext executes a query that doesn't return rows, such as an INSERT or UPDATE. ExecContext must honor the context timeout and return when it is canceled.
( ctx context.Context, args []driver.NamedValue, )
| 76 | // |
| 77 | // ExecContext must honor the context timeout and return when it is canceled. |
| 78 | func (s *proxyStmt) ExecContext( |
| 79 | ctx context.Context, args []driver.NamedValue, |
| 80 | ) (driver.Result, error) { |
| 81 | if IsRecording() { |
| 82 | var res driver.Result |
| 83 | var err error |
| 84 | if execCtx, ok := s.stmt.(driver.StmtExecContext); ok { |
| 85 | res, err = execCtx.ExecContext(ctx, args) |
| 86 | } else { |
| 87 | var vals []driver.Value |
| 88 | vals, err = namedValueToValue(args) |
| 89 | if err != nil { |
| 90 | return nil, err |
| 91 | } |
| 92 | res, err = s.stmt.Exec(vals) |
| 93 | } |
| 94 | |
| 95 | currentSession.AddRecord(&record{Typ: StmtExec, Args: recordArgs{err}}) |
| 96 | if err != nil { |
| 97 | return nil, err |
| 98 | } |
| 99 | return &proxyResult{res: res}, nil |
| 100 | } |
| 101 | |
| 102 | rec, err := currentSession.VerifyRecord(StmtExec) |
| 103 | if err != nil { |
| 104 | return nil, err |
| 105 | } |
| 106 | err, _ = rec.Args[0].(error) |
| 107 | if err != nil { |
| 108 | return nil, err |
| 109 | } |
| 110 | return &proxyResult{}, nil |
| 111 | } |
| 112 | |
| 113 | // Query executes a query that may return rows, such as a |
| 114 | // SELECT. |
nothing calls this directly
no test coverage detected