executeAutoCommit executes a single statement in auto-commit mode
(ctx context.Context, statement string)
| 317 | |
| 318 | // executeAutoCommit executes a single statement in auto-commit mode |
| 319 | func (d *Driver) executeAutoCommit(ctx context.Context, statement string) (int64, error) { |
| 320 | sqlResult, err := d.db.ExecContext(ctx, statement) |
| 321 | if err != nil { |
| 322 | return 0, errors.Wrap(err, "failed to execute statement in auto-commit mode") |
| 323 | } |
| 324 | rowsAffected, err := sqlResult.RowsAffected() |
| 325 | if err != nil { |
| 326 | // Since we cannot differentiate DDL and DML yet, we have to ignore the error. |
| 327 | slog.Debug("rowsAffected returns error in auto-commit mode", log.BBError(err)) |
| 328 | return 0, nil |
| 329 | } |
| 330 | return rowsAffected, nil |
| 331 | } |
| 332 | |
| 333 | func execute(ctx context.Context, txn *sql.Tx, statement string) (int64, error) { |
| 334 | sqlResult, err := txn.ExecContext(ctx, statement) |
no test coverage detected