Skip to content

Commit

Permalink
doc: clarify connection close behavior of context (go-sql-driver#1606)
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 if the `context.Context` provided to
`ExecContext`, `SelectContext`, etc. is cancelled or times out prior to
the query returning.
  • Loading branch information
chriskirkland authored and methane committed Nov 13, 2024
1 parent 89e0c02 commit 04bcabf
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 `_`):
Expand Down

0 comments on commit 04bcabf

Please sign in to comment.