What's Changed
Major changes
-
Use
SET NAMES charset COLLATE collation
. by @methane in #1437- Older go-mysql-driver used
collation_id
in the handshake packet. But it caused collation mismatch in some situation. - If you don't specify charset nor collation, go-mysql-driver sends
SET NAMES utf8mb4
for new connection. This uses server's default collation for utf8mb4. - If you specify charset, go-mysql-driver sends
SET NAMES <charset>
. This uses the server's default collation for<charset>
. - If you specify collation and/or charset, go-mysql-driver sends
SET NAMES charset COLLATE collation
.
- Older go-mysql-driver used
-
PathEscape dbname in DSN. by @methane in #1432
- This is backward incompatible in rare case. Check your DSN.
-
Drop Go 1.13-17 support by @methane in #1420
- Use Go 1.18+
-
Parse numbers on text protocol too by @methane in #1452
- When text protocol is used, go-mysql-driver passed bare
[]byte
to database/sql for avoid unnecessary allocation and conversion. - If user specified
*any
toScan()
, database/sql passed the[]byte
into the target variabe. - This confused users because most user doesn't know when text/binary protocol used.
- go-mysql-driver 1.8 converts integer/float values into int64/double even in text protocol. This doesn't increase allocation compared to
[]byte
and conversion cost is negilible.
- When text protocol is used, go-mysql-driver passed bare
-
New options start using the Functional Option Pattern to avoid increasing technical debt in the Config object. Future version may introduce Functional Option for existing options, but not for now.
- Make TimeTruncate functional option by @methane in #1552
- Add BeforeConnect callback to configuration object by @ItalyPaleAle in #1469
Other changes
-
Adding DeregisterDialContext to prevent memory leaks with dialers we don't need anymore by @jypelle in #1422
-
Make logger configurable per connection by @frozenbonito in #1408
-
Fix ColumnType.DatabaseTypeName for mediumint unsigned by @evanelias in #1428
-
Add connection attributes by @Daemonxiao in #1389
-
Stop
ColumnTypeScanType()
from returningsql.RawBytes
by @methane in #1424 -
Exec() now provides access to status of multiple statements. by @mherr-google in #1309
-
Allow to change (or disable) the default driver name for registration by @dolmen in #1499
-
Add default connection attribute '_server_host' by @oblitorum in #1506
-
QueryUnescape DSN ConnectionAttribute value by @zhangyangyu in #1470
-
Avoid panic in TestRowsColumnTypes by @wayyoungboy in #1426
-
Reduce map lookup in ColumnTypeDatabaseTypeName. by @methane in #1436
-
doc: add link to NewConnector from FormatDSN by @dolmen in #1442
-
Add fuzz test for ParseDSN / FormatDSN roundtrip by @dolmen in #1444
-
TestDSNReformat: add more roundtrip checks by @dolmen in #1443
-
tcp: handle errors returned by SetKeepAlive by @achille-roussel in #1448
-
Add Daemonxiao to AUTHORS by @Daemonxiao in #1459
-
Update link about
LOAD DATA LOCAL
in README.md by @i7a7467 in #1468 -
add Go 1.21 and MySQL 8.1 to the build matrix by @shogo82148 in #1472
-
Improve DSN docstsrings by @golddranks in #1475
-
Fix #1478 remove length check by @ShenFeng312 in #1481
-
Close connection on ErrPktSync and ErrPktSyncMul by @owbone in #1473
-
move stale connection check to ResetSession() by @methane in #1496
-
fix race condition of TestConcurrent by @shogo82148 in #1490
-
mark fail, mustExec and mustQuery as test helpers by @shogo82148 in #1488
-
testing: expose testing.TB in DBTest instead of full *testing.T by @dolmen in #1500
-
symbol removed from installation command by @panvalkar1994 in #1510
-
fix issue 1361 by @keeplearning20221 in #1462
-
Fix sql.RawBytes corruption issue by @shogo82148 in #1523
-
fix for enum and set field type to column type identifying by @jennifersp in #1520
-
Parallelize test by @shogo82148 in #1525
-
Fix unsigned int overflow by @shiyuhang0 in #1530
-
Introduce
timeTruncate
parameter fortime.Time
arguments by @PauliusLozys in #1541 -
add TiDB support in README.md by @crazycs520 in #1333
New Contributors
- @EPuncker made their first contribution in #1421
- @jypelle made their first contribution in #1422
- @frozenbonito made their first contribution in #1408
- @wayyoungboy made their first contribution in #1426
- @evanelias made their first contribution in #1428
- @Daemonxiao made their first contribution in #1389
- @uji made their first contribution in #1438
- @testwill made their first contribution in #1439
- @i7a7467 made their first contribution in #1468
- @Netzer7 made their first contribution in #1464
- @golddranks made their first contribution in #1475
- @ShenFeng312 made their first contribution in #1481
- @owbone made their first contribution in #1473
- @scop made their first contribution in #1485
- @panvalkar1994 made their first contribution in #1510
- @zhangyangyu made their first contribution in #1470
- @keeplearning20221 made their first contribution in #1462
- @oblitorum made their first contribution in #1506
- @Gusted made their first contribution in #1518
- @jennifersp made their first contribution in #1520
- @shiyuhang0 made their first contribution in #1530
- @PauliusLozys made their first contribution in #1541
- @crazycs520 made their first contribution in #1333
- @ItalyPaleAle made their first contribution in #1469
Full Changelog: v1.7.1...v1.8.0