Use finalizers to detect unclosed connections.

This commit is contained in:
Nuno Cruces
2023-03-03 13:15:24 +00:00
parent 416c3863a0
commit 35b1a97b88
5 changed files with 27 additions and 5 deletions

View File

@@ -29,6 +29,7 @@ func TestConn_Transaction_exec(t *testing.T) {
if err != nil {
t.Fatal(err)
}
defer stmt.Close()
if stmt.Step() {
return stmt.ColumnInt(0)
}
@@ -117,6 +118,7 @@ func TestConn_Transaction_panic(t *testing.T) {
if err != nil {
t.Fatal(err)
}
defer stmt.Close()
if stmt.Step() {
got := stmt.ColumnInt(0)
if got != 1 {
@@ -275,6 +277,7 @@ func TestConn_Savepoint_exec(t *testing.T) {
if err != nil {
t.Fatal(err)
}
defer stmt.Close()
if stmt.Step() {
return stmt.ColumnInt(0)
}
@@ -361,6 +364,7 @@ func TestConn_Savepoint_panic(t *testing.T) {
if err != nil {
t.Fatal(err)
}
defer stmt.Close()
if stmt.Step() {
got := stmt.ColumnInt(0)
if got != 1 {