mirror of
https://github.com/golang/go
synced 2024-11-24 23:07:56 -07:00
database/sql: support ErrSkip in Tx.Exec
If the database driver supports the Execer interface but returns ErrSkip, calling Exec on a transaction was returning the error instead of using the slow path. R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/5654044
This commit is contained in:
parent
eaf640dbc4
commit
aca4a6c933
@ -523,10 +523,12 @@ func (tx *Tx) Exec(query string, args ...interface{}) (Result, error) {
|
||||
|
||||
if execer, ok := ci.(driver.Execer); ok {
|
||||
resi, err := execer.Exec(query, args)
|
||||
if err != nil {
|
||||
if err == nil {
|
||||
return result{resi}, nil
|
||||
}
|
||||
if err != driver.ErrSkip {
|
||||
return nil, err
|
||||
}
|
||||
return result{resi}, nil
|
||||
}
|
||||
|
||||
sti, err := ci.Prepare(query)
|
||||
|
Loading…
Reference in New Issue
Block a user