aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/database/sql/sql.go
diff options
context:
space:
mode:
authorAndrew Balholm <andybalholm@gmail.com>2012-02-10 09:19:22 +1100
committerBrad Fitzpatrick <bradfitz@golang.org>2012-02-10 09:19:22 +1100
commitaca4a6c933c34f136408653c30595a9471372d5e (patch)
treef1da4f21ee2158e803ec5ff650f3f7140ff46c29 /src/pkg/database/sql/sql.go
parenteaf640dbc41ab96dbae5b55708b2e42eec22fd53 (diff)
downloadgo-aca4a6c933c34f136408653c30595a9471372d5e.tar.xz
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
Diffstat (limited to 'src/pkg/database/sql/sql.go')
-rw-r--r--src/pkg/database/sql/sql.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/pkg/database/sql/sql.go b/src/pkg/database/sql/sql.go
index fe43f92b98..e7a067b893 100644
--- a/src/pkg/database/sql/sql.go
+++ b/src/pkg/database/sql/sql.go
@@ -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)