1
0
mirror of https://github.com/golang/go synced 2024-11-25 03:17:58 -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:
Andrew Balholm 2012-02-10 09:19:22 +11:00 committed by Brad Fitzpatrick
parent eaf640dbc4
commit aca4a6c933

View File

@ -523,10 +523,12 @@ func (tx *Tx) Exec(query string, args ...interface{}) (Result, error) {
if execer, ok := ci.(driver.Execer); ok { if execer, ok := ci.(driver.Execer); ok {
resi, err := execer.Exec(query, args) resi, err := execer.Exec(query, args)
if err != nil { if err == nil {
return result{resi}, nil
}
if err != driver.ErrSkip {
return nil, err return nil, err
} }
return result{resi}, nil
} }
sti, err := ci.Prepare(query) sti, err := ci.Prepare(query)