aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/database/sql/driver
diff options
context:
space:
mode:
authorBrad Fitzpatrick <bradfitz@golang.org>2012-03-08 10:09:52 -0800
committerBrad Fitzpatrick <bradfitz@golang.org>2012-03-08 10:09:52 -0800
commit9fb68a9a0a4229bc15688b448d0a5e8abff4b2dd (patch)
tree8aecab57c342315735bcd872e74f67c16ec8e70b /src/pkg/database/sql/driver
parentb492bbe0d6e34b1b6a225ad98ba44eda9e23362f (diff)
downloadgo-9fb68a9a0a4229bc15688b448d0a5e8abff4b2dd.tar.xz
database/sql{,driver}: add ErrBadConn
R=golang-dev, rsc CC=golang-dev https://golang.org/cl/5785043
Diffstat (limited to 'src/pkg/database/sql/driver')
-rw-r--r--src/pkg/database/sql/driver/driver.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/pkg/database/sql/driver/driver.go b/src/pkg/database/sql/driver/driver.go
index 7f986b80f2..2f5280db81 100644
--- a/src/pkg/database/sql/driver/driver.go
+++ b/src/pkg/database/sql/driver/driver.go
@@ -43,6 +43,17 @@ type Driver interface {
// documented.
var ErrSkip = errors.New("driver: skip fast-path; continue as if unimplemented")
+// ErrBadConn should be returned by a driver to signal to the sql
+// package that a driver.Conn is in a bad state (such as the server
+// having earlier closed the connection) and the sql package should
+// retry on a new connection.
+//
+// To prevent duplicate operations, ErrBadConn should NOT be returned
+// if there's a possibility that the database server might have
+// performed the operation. Even if the server sends back an error,
+// you shouldn't return ErrBadConn.
+var ErrBadConn = errors.New("driver: bad connection")
+
// Execer is an optional interface that may be implemented by a Conn.
//
// If a Conn does not implement Execer, the db package's DB.Exec will