Skip to content

Commit 44553d6

Browse files
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.
1 parent f6a18cf commit 44553d6

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Diff for: README.md

+3
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,9 @@ This driver supports the [`ColumnType` interface](https://golang.org/pkg/databas
519519
Go 1.8 added `database/sql` support for `context.Context`. This driver supports query timeouts and cancellation via contexts.
520520
See [context support in the database/sql package](https://golang.org/doc/go1.8#database_sql) for more details.
521521

522+
> [!IMPORTANT]
523+
> 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.
524+
522525

523526
### `LOAD DATA LOCAL INFILE` support
524527
For this feature you need direct access to the package. Therefore you must change the import path (no `_`):

0 commit comments

Comments
 (0)