Skip to content

Commit aa60ff2

Browse files
committed
Explicitly specify collation when resetting connection. Fixes #243
Since the 'collation_connection' system variable is only used for comparing string literals, it should be safe to always use utf8mb4_bin (for consistency) and not accept the server's current default collation for utf8mb4.
1 parent 8a54bdd commit aa60ff2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/MySqlConnector/Serialization/MySqlSession.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ public async Task ResetConnectionAsync(ConnectionSettings cs, IOBehavior ioBehav
229229
OkPayload.Create(payload);
230230

231231
// the "reset connection" packet also resets the connection charset, so we need to change that back to our default
232-
payload = new PayloadData(new ArraySegment<byte>(PayloadUtilities.CreateEofStringPayload(CommandKind.Query, "SET NAMES utf8mb4;")));
232+
payload = new PayloadData(new ArraySegment<byte>(PayloadUtilities.CreateEofStringPayload(CommandKind.Query, "SET NAMES utf8mb4 COLLATE utf8mb4_bin;")));
233233
await SendAsync(payload, ioBehavior, cancellationToken).ConfigureAwait(false);
234234
payload = await ReceiveReplyAsync(ioBehavior, cancellationToken).ConfigureAwait(false);
235235
OkPayload.Create(payload);

0 commit comments

Comments
 (0)