2
0

stdlib: implement Conn.ResetSession

This prevents closed connections from being returned
by `database.sql.DB.Conn`.

Fixes #974.
This commit is contained in:
Jonathan Amsterdam
2021-03-26 08:32:04 -04:00
committed by Jack Christensen
parent 909b81a163
commit 88ede6efb5
2 changed files with 13 additions and 5 deletions
+7
View File
@@ -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