Skip to content

Commit

Permalink
using sql.NullString for localNetAddr
Browse files Browse the repository at this point in the history
  • Loading branch information
parMaster committed Oct 11, 2024
1 parent 4cc1635 commit 5c143a7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tds_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5c143a7

Please sign in to comment.