Close database/sql connections created through ConnPool
database/sql driver created through stdlib.OpenFromConnPool closes connections when requested by database/sql rather than release to underlying connection pool.
This commit is contained in:
@@ -1,3 +1,9 @@
|
|||||||
|
# Unreleased
|
||||||
|
|
||||||
|
## Fixes
|
||||||
|
|
||||||
|
* database/sql driver created through stdlib.OpenFromConnPool closes connections when requested by database/sql rather than release to underlying connection pool.
|
||||||
|
|
||||||
# 2.11.0 (June 5, 2017)
|
# 2.11.0 (June 5, 2017)
|
||||||
|
|
||||||
## Fixes
|
## Fixes
|
||||||
|
|||||||
+2
-2
@@ -180,12 +180,12 @@ func (c *Conn) Prepare(query string) (driver.Stmt, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Conn) Close() error {
|
func (c *Conn) Close() error {
|
||||||
|
err := c.conn.Close()
|
||||||
if c.pool != nil {
|
if c.pool != nil {
|
||||||
c.pool.Release(c.conn)
|
c.pool.Release(c.conn)
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return c.conn.Close()
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Conn) Begin() (driver.Tx, error) {
|
func (c *Conn) Begin() (driver.Tx, error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user