Commit aca4a6c9 authored by Andrew Balholm's avatar Andrew Balholm Committed by Brad Fitzpatrick

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
parent eaf640db
...@@ -523,10 +523,12 @@ func (tx *Tx) Exec(query string, args ...interface{}) (Result, error) { ...@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment