mysql-net / MySqlConnector

MySQL Connector for .NET
https://mysqlconnector.net
MIT License
1.39k stars 333 forks source link

ResetConnectionAsync doesn't preserve `character_set_connection` #1090

Open bgrainger opened 2 years ago

bgrainger commented 2 years ago

ResetConnectionAsync (added in https://github.com/mysql-net/MySqlConnector/commit/ffea49465806367248a88dba93610381a5d1476b for https://github.com/mysql-net/MySqlConnector/issues/831) only sends a connection reset packet. This sets the connection charset to the server default charset, not the initial connection charset: https://bugs.mysql.com/bug.php?id=97633

Consequently, result sets may have the wrong encoding for commands subsequently executed on the connection.

We should abstract away this bug from the consumer by automatically executing SET NAMES. With pipelining (#1088) this won't be any less efficient.

bgrainger commented 1 year ago

automatically executing SET NAMES

Note that this is unnecessary for MariaDB: https://github.com/mysql-net/MySqlConnector/issues/1236. So the current behaviour is desirable for that DB backend.