go/src/database/sql
Daniel Theophanes 6a223b82a4 database/sql: add driver.ResetSessioner and add pool support
A single database connection ususally maps to a single session.
A connection pool is logically also a session pool. Most
sessions have a way to reset the session state which is desirable
to prevent one bad query from poisoning another later query with
temp table name conflicts or other persistent session resources.

It also lets drivers provide users with better error messages from
queryies when the underlying transport or query method fails.
Internally the driver connection should now be marked as bad, but
return the actual connection. When ResetSession is called on the
connection it should return driver.ErrBadConn to remove it from
the connection pool. Previously drivers had to choose between
meaningful error messages or poisoning the connection pool.

Lastly update TestPoolExhaustOnCancel from relying on a
WAIT query fixing a flaky timeout issue exposed by this
change.

Fixes #22049
Fixes #20807

Change-Id: I2b5df6d954a38d0ad93bf1922ec16e74c827274c
Reviewed-on: https://go-review.googlesource.com/73033
Run-TryBot: Daniel Theophanes <kardianos@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-10-24 21:37:46 +00:00
..
driver database/sql: add driver.ResetSessioner and add pool support 2017-10-24 21:37:46 +00:00
convert.go database/sql: convertAssign string and time.Time into RawBytes 2017-10-01 16:41:57 +00:00
convert_test.go database/sql: convertAssign string and time.Time into RawBytes 2017-10-01 16:41:57 +00:00
ctxutil.go database/sql: allow drivers to only implement Context variants 2017-10-24 16:51:29 +00:00
doc.txt database/sql: fix outdated package name in doc.txt 2017-06-30 19:11:17 +00:00
example_test.go all: minor vet fixes 2016-10-24 17:27:37 +00:00
fakedb_test.go database/sql: add driver.ResetSessioner and add pool support 2017-10-24 21:37:46 +00:00
sql.go database/sql: add driver.ResetSessioner and add pool support 2017-10-24 21:37:46 +00:00
sql_test.go database/sql: add driver.ResetSessioner and add pool support 2017-10-24 21:37:46 +00:00