mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
database/sql: ensure all driver Stmt are closed once
Previously driver.Stmt could could be closed multiple times in edge cases that drivers may not test for initially. Make their job easier by ensuring the driver is only closed a single time. Fixes #16019 Change-Id: I1e4777ef70697a849602e6ef9da73054a8feb4cd Reviewed-on: https://go-review.googlesource.com/33352 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
e0942b76c7
commit
90b8a0ca2d
2 changed files with 88 additions and 77 deletions
|
|
@ -672,7 +672,7 @@ func TestStatementClose(t *testing.T) {
|
|||
msg string
|
||||
}{
|
||||
{&Stmt{stickyErr: want}, "stickyErr not propagated"},
|
||||
{&Stmt{tx: &Tx{}, txsi: &driverStmt{&sync.Mutex{}, stubDriverStmt{want}}}, "driverStmt.Close() error not propagated"},
|
||||
{&Stmt{tx: &Tx{}, txds: &driverStmt{Locker: &sync.Mutex{}, si: stubDriverStmt{want}}}, "driverStmt.Close() error not propagated"},
|
||||
}
|
||||
for _, test := range tests {
|
||||
if err := test.stmt.Close(); err != want {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue