mirror of
https://github.com/golang/go
synced 2024-11-26 02:07:57 -07:00
database/sql: add error check
Change-Id: Ib9f7a1a4bf23f76457dabf85610f4799502631dc
GitHub-Last-Rev: afbb86fde1
GitHub-Pull-Request: golang/go#65947
Reviewed-on: https://go-review.googlesource.com/c/go/+/566857
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
This commit is contained in:
parent
b426e9797f
commit
88b2f25005
@ -140,6 +140,10 @@ where
|
||||
|
||||
var orderRef = "ABC123"
|
||||
tx, err := db.BeginTx(ctx, &sql.TxOptions{Isolation: sql.LevelSerializable})
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
_, err = tx.ExecContext(ctx, "stored_proc_name", orderRef)
|
||||
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user