Bug #29576 | It's not possible to set charset before connecting - crash | ||
---|---|---|---|
Submitted: | 5 Jul 2007 15:15 | Modified: | 9 Jul 2007 6:21 |
Reporter: | Andrey Hristov | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server: C API (client library) | Severity: | S2 (Serious) |
Version: | 4.1+ | OS: | Any |
Assigned to: | Ramil Kalimullin | CPU Architecture: | Any |
[5 Jul 2007 15:15]
Andrey Hristov
[6 Jul 2007 15:57]
MySQL Verification Team
Thank you for the bug report.
[9 Jul 2007 6:21]
Ramil Kalimullin
Hi Andrey! You are not allowed to call the mysql_set_character_set() function *before* the mysql_real_connect(). The purpose of the function is to tune the current connection, see http://dev.mysql.com/doc/refman/5.0/en/mysql-set-character-set.html "This function is used to set the default character set for the current connection." and http://dev.mysql.com/doc/refman/5.0/en/mysql-real-connect.html "... mysql_real_connect() must complete successfully before you can execute any other API functions that require a valid MYSQL connection handle structure". You can use the mysql_options() to set some connect options (note: MYSQL_INIT_COMMAND and MYSQL_SET_CHARSET_NAME), see http://dev.mysql.com/doc/refman/5.0/en/mysql-options.html "Can be used to set extra connect options and affect behavior for a connection. This function may be called multiple times to set several options. mysql_options() should be called after mysql_init() and before mysql_connect() or mysql_real_connect()". Regards, Ramil.
[31 Jul 2007 5:43]
Tonci Grgin
Reflection on Bug#29853: What we have here is more of a general problem. Maybe we should note the problem with characters outside BMP and with 7bit encodings in the manual?