From 44553d64bcde78a5b58cb133a5cc708281c333e0 Mon Sep 17 00:00:00 2001 From: Chris Kirkland Date: Tue, 23 Jul 2024 21:45:26 -0500 Subject: [PATCH] doc: clarify connection close behavior of context (#1606) Updates the README to make it clear that `go-sql-driver/mysql` closes the current connection if the `context.Context` provided to `ExecContext`, `SelectContext`, etc. is cancelled or times out prior to the query returning. --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 6c6abf9c4..c83f4f74f 100644 --- a/README.md +++ b/README.md @@ -519,6 +519,9 @@ This driver supports the [`ColumnType` interface](https://golang.org/pkg/databas Go 1.8 added `database/sql` support for `context.Context`. This driver supports query timeouts and cancellation via contexts. See [context support in the database/sql package](https://golang.org/doc/go1.8#database_sql) for more details. +> [!IMPORTANT] +> The `QueryContext`, `ExecContext`, etc. variants provided by `database/sql` will cause the connection to be closed if the provided context is cancelled or timed out before the result is received by the driver. + ### `LOAD DATA LOCAL INFILE` support For this feature you need direct access to the package. Therefore you must change the import path (no `_`):