Skip to content

Commit

Permalink
[Docs] clarify connection close behavior of context
Browse files Browse the repository at this point in the history
Updates the README to make it clear that `go-sql-driver/mysql` closes the current connection of the `context.Context` provided to `ExecContext`, `SelectContext`, etc. is cancelled or times out prior to the query returning.

As is, that behavior is not clearly documented.
  • Loading branch information
chriskirkland authored Jul 9, 2024
1 parent 3484db1 commit e330067
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,8 @@ 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.

Importantly, the `SelectContext`, `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 `_`):
Expand Down

0 comments on commit e330067

Please sign in to comment.