stdlib: implement Conn.ResetSession
This prevents closed connections from being returned by `database.sql.DB.Conn`. Fixes #974.
This commit is contained in:
committed by
Jack Christensen
parent
909b81a163
commit
88ede6efb5
@@ -385,6 +385,13 @@ func (c *Conn) CheckNamedValue(*driver.NamedValue) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Conn) ResetSession(ctx context.Context) error {
|
||||
if c.conn.IsClosed() {
|
||||
return driver.ErrBadConn
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Stmt struct {
|
||||
sd *pgconn.StatementDescription
|
||||
conn *Conn
|
||||
|
||||
Reference in New Issue
Block a user