For several commands (e.g. SET NAMES, SET character_set, USE database, SET
SQL_MODE) the client receives an ok packet only without information about server
status changes: e.g. after SET NAMES big5 the server assumes that the client
will send big5 encoded data, while the client character set is still latin1 (see
http://lists.mysql.com/announce/364).
Proposal: extend the OK packet to allow server to send more information.
Bytes Name
----- ----
1 (Length Coded Binary) field_count, always = 0
1-9 (Length Coded Binary) affected_rows
1-9 (Length Coded Binary) insert_id
2 server_status
2 warning_count
n (until end of packet) message
if server_status has a flag SERVER_STATUS_CHANGED server will send after
warning_count
1 enum key (CHANGED_SQLMODE, CHANGED_SCHEMA,
CHANGED_CHARSET, ....)
n (until end of packet) data: e.g charset no, new sql_mode, database name
List of server changes we need to transmit:
- client character set
- current database
- sql_mode
Related bugs:
BUG#32271: mysql client unicode output incorrectly padded
