From 5c143a721ddbfe8b1512f78d0af4a36b722d3f7d Mon Sep 17 00:00:00 2001 From: parmaster Date: Fri, 11 Oct 2024 18:16:44 +0300 Subject: [PATCH] using sql.NullString for localNetAddr --- tds_test.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tds_test.go b/tds_test.go index 497f7a12..3fd102fa 100644 --- a/tds_test.go +++ b/tds_test.go @@ -709,11 +709,14 @@ func TestLeakedConnections(t *testing.T) { t.Fatal("Ping with good credentials should not fail, but got error:", err.Error()) } - var localNetAddr string + var localNetAddr sql.NullString err = goodConn.QueryRow("SELECT local_net_address FROM sys.dm_exec_connections WHERE session_id=@@SPID").Scan(&localNetAddr) if err != nil { t.Fatal("cannot scan local_net_address value", err) } + if !localNetAddr.Valid { + t.Fatal("local_net_address should not be NULL") + } // Remember the number of open connections from local_net_address, excluding the current one var openConnections int