Closed methane closed 2 months ago
The recent changes enhance the handling of charset and collation settings in the Go MySQL driver. The updates enable efficient collation handling by converting string-based collations to ID-based ones. The connection logic is simplified by consolidating system variable settings into a single command. Additionally, the changes improve error management and provide better support for custom collation specifications, ensuring accurate collation assignments during database interactions.
File | Summary |
---|---|
collations.go |
Renamed defaultCollation to defaultCollationID and changed its value to 45 for better clarity and efficiency. |
connection.go |
Simplified handleParams function by consolidating system variable settings into a single SET command. |
connector.go |
Updated Connect method to handle character set settings and collations based on provided configurations. |
dsn.go |
Added charsets field to Config struct and updated collation handling in DSN formatting and parsing functions. |
dsn_test.go |
Modified Config struct in tests to use the new charsets field instead of a map for connection charset settings. |
packets.go |
Revised writeHandshakeResponsePacket function to properly set collation ID based on collation and charset. |
N/A
Objective | Addressed | Explanation |
---|---|---|
Connection collations limit use of custom collation specification (#1603) | ✅ | |
Handle charset and collation assignments more efficiently during connection establishment (#1603) | ✅ | |
Simplify and consolidate connection parameter handling logic (#1603) | ✅ |
Amid the bytes and lines we tread,
Collations once brought us dread,
But now with elegance, they're set,
In charset fields, we won't forget.
Code refined, with charsets arrayed,
Bugs dispelled, and progress made.
Cheers to change, where bugs have bled,
A future bright, now lies ahead! ☀️
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Description
Fix #1603
Checklist
Summary by CodeRabbit
New Features
Bug Fixes
Refactor
Tests