We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 52aff4c commit 14d3dedCopy full SHA for 14d3ded
sql.go
@@ -67,9 +67,19 @@ func (d *sqlDriver) attach(c *xsql.Connector, parent *Driver) {
67
}
68
69
func (d *sqlDriver) detach(c *xsql.Connector) {
70
+ var countConnectorsPerDriver int
71
parent, _ := d.connectors.Extract(c)
- if d.connectors.Len() == 0 && parent != nil {
72
- _ = parent.Close(context.Background())
+ if parent != nil {
73
+ d.connectors.Range(func(key *xsql.Connector, value *Driver) bool {
74
+ if value == parent {
75
+ countConnectorsPerDriver++
76
+ }
77
+
78
+ return true
79
+ })
80
+ if countConnectorsPerDriver == 0 {
81
+ _ = parent.Close(context.Background())
82
83
84
85
0 commit comments