MCPcopy Create free account
hub / github.com/cockroachdb/copyist / ExecContext

Method ExecContext

conn.go:73–109  ·  view source on GitHub ↗

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, query string, args []driver.NamedValue,
)

Source from the content-addressed store, hash-verified

71//
72// ExecContext must honor the context timeout and return when it is canceled.
73func (c *proxyConn) ExecContext(
74 ctx context.Context, query string, args []driver.NamedValue,
75) (driver.Result, error) {
76 if IsRecording() {
77 var res driver.Result
78 var err error
79 switch t := c.conn.(type) {
80 case driver.ExecerContext:
81 res, err = t.ExecContext(ctx, query, args)
82 case driver.Execer:
83 var vals []driver.Value
84 vals, err = namedValueToValue(args)
85 if err != nil {
86 return nil, err
87 }
88 res, err = t.Exec(query, vals)
89 default:
90 return nil, driver.ErrSkip
91 }
92
93 currentSession.AddRecord(&record{Typ: ConnExec, Args: recordArgs{query, err}})
94 if err != nil {
95 return nil, err
96 }
97 return &proxyResult{res: res}, nil
98 }
99
100 rec, err := currentSession.VerifyRecordWithStringArg(ConnExec, query)
101 if err != nil {
102 return nil, err
103 }
104 err, _ = rec.Args[1].(error)
105 if err != nil {
106 return nil, err
107 }
108 return &proxyResult{}, nil
109}
110
111// Prepare returns a prepared statement, bound to this connection.
112func (c *proxyConn) Prepare(query string) (driver.Stmt, error) {

Callers

nothing calls this directly

Calls 5

IsRecordingFunction · 0.85
namedValueToValueFunction · 0.85
ExecMethod · 0.80
AddRecordMethod · 0.80

Tested by

no test coverage detected