ExecContext implements the driver.ExecerContext.ExecContext method.
(ctx context.Context, query string, args []driver.NamedValue)
| 274 | |
| 275 | // ExecContext implements the driver.ExecerContext.ExecContext method. |
| 276 | func (c *conn) ExecContext(ctx context.Context, query string, args []driver.NamedValue) (result driver.Result, err error) { |
| 277 | defer trace.StartRegion(ctx, "dbExec").End() |
| 278 | |
| 279 | if atomic.LoadInt32(&c.closed) != 0 { |
| 280 | err = driver.ErrBadConn |
| 281 | return |
| 282 | } |
| 283 | |
| 284 | // TODO(xq262144): make use of the ctx argument |
| 285 | sq := convertQuery(query, args) |
| 286 | |
| 287 | var affectedRows, lastInsertID int64 |
| 288 | if affectedRows, lastInsertID, _, err = c.addQuery(ctx, types.WriteQuery, sq); err != nil { |
| 289 | return |
| 290 | } |
| 291 | |
| 292 | result = &execResult{ |
| 293 | affectedRows: affectedRows, |
| 294 | lastInsertID: lastInsertID, |
| 295 | } |
| 296 | return |
| 297 | } |
| 298 | |
| 299 | // QueryContext implements the driver.QueryerContext.QueryContext method. |
| 300 | func (c *conn) QueryContext(ctx context.Context, query string, args []driver.NamedValue) (rows driver.Rows, err error) { |
nothing calls this directly
no test coverage detected