go/src/database/sql
Ivan Trubach 194b636f8f database/sql: close driver.Connector if it implements io.Closer
This change allows driver implementations to manage resources in
driver.Connector, e.g. to share the same underlying database handle
between multiple connections. That is, it allows embedded databases
with in-memory backends like SQLite and Genji to safely release the
resources once the sql.DB is closed.

This makes it possible to address oddities with in-memory stores in
SQLite and Genji drivers without introducing too much complexity in
the driver implementations.

See also:
- https://github.com/mattn/go-sqlite3/issues/204
- https://github.com/mattn/go-sqlite3/issues/511
- https://github.com/genjidb/genji/issues/210

Fixes #41790

Change-Id: Idbd19763134438ed38288b9d44f16608e4e97fd7
GitHub-Last-Rev: 962c785dfb
GitHub-Pull-Request: golang/go#41710
Reviewed-on: https://go-review.googlesource.com/c/go/+/258360
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Daniel Theophanes <kardianos@gmail.com>
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-02-25 19:34:27 +00:00
..
driver database/sql: close driver.Connector if it implements io.Closer 2021-02-25 19:34:27 +00:00
convert.go all: fix typos 2019-09-08 17:28:20 +00:00
convert_test.go all: fix typos 2019-09-08 17:28:20 +00:00
ctxutil.go std: remove unused bits of code all over the place 2019-09-02 12:57:37 +00:00
doc.txt
example_cli_test.go database/sql: add examples for opening and testing a DB pool 2018-11-16 17:17:09 +00:00
example_service_test.go database/sql: add examples for opening and testing a DB pool 2018-11-16 17:17:09 +00:00
example_test.go database/sql: fix incorrect function name in example_test 2020-04-28 14:05:09 +00:00
fakedb_test.go database/sql: close driver.Connector if it implements io.Closer 2021-02-25 19:34:27 +00:00
sql.go database/sql: close driver.Connector if it implements io.Closer 2021-02-25 19:34:27 +00:00
sql_test.go database/sql: close driver.Connector if it implements io.Closer 2021-02-25 19:34:27 +00:00