Bug #32589 Allow 'SET NAMES' and other character set variables to be locked down
Submitted: 21 Nov 2007 18:29 Modified: 22 Nov 2007 5:13
Reporter: Jim Winstead Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Charsets Severity:S4 (Feature request)
Version:5.0 OS:Any
Assigned to: Assigned Account CPU Architecture:Any
Tags: character sets, SET NAMES
Triage: Triaged: D5 (Feature request)

[21 Nov 2007 18:29] Jim Winstead
Description:
For most of the connectors (ODBC, .NET, Java), it is bad if the user tries to change the connection-related character set variables using SET NAMES or by setting them directly. It would be nice to have a way to lock down these settings once the driver has set them to what it expects.

How to repeat:
Use 'SET NAMES' with C/ODBC 5.1, C/J, or C/NET and watch the chaos ensue.

C/J actually checks every query before it is sent to the server to make sure it isn't 'SET NAMES'. It would be nice if the connectors didn't have to do this.

Suggested fix:
SET @session.character_set_locked = TRUE;
[22 Nov 2007 5:13] Valeriy Kravchuk
Thank you for a reasonable feature request.
[21 Oct 2010 9:00] Alexander Barkov
Perhaps extending MySQL client-server protocol could be more useful here.

The idea is to inform client whenever changes in character set related 
variables happen, so the client program (e.g. ODBC driver) can do relevant
changes in client side variables.