Bug #33835 mysql_options() can still be called successfully after mysql_real_connect()
Submitted: 12 Jan 2008 15:50 Modified: 12 Feb 2008 17:56
Reporter: Hartmut Holzgraefe Email Updates:
Status: No Feedback Impact on me:
Category:MySQL Server: C API (client library) Severity:S3 (Non-critical)
Version:5.1.22 OS:Any
Assigned to: CPU Architecture:Any

[12 Jan 2008 15:50] Hartmut Holzgraefe
mysql_options() can still be called after mysql_real_connect() without any error or warning although the call only makes sense *before* establishing a connection.

How to repeat:
See attached test program

Suggested fix:
mysql_options() calls after a connection has already been established sould return an error code instead of failing silently without any warning
[12 Jan 2008 15:53] Hartmut Holzgraefe
test project source

Attachment: bug33835-0.1.tar.gz (application/x-gzip, text), 292.94 KiB.

[12 Jan 2008 16:02] Paul DuBois
Disallowing mysql_options() after mysql_real_connect() might cause breakage of old programs that are written to use this workaround:

Note: mysql_real_connect() incorrectly reset the MYSQL_OPT_RECONNECT option to its default value before MySQL 5.0.19. Therefore, prior to that version, if you want reconnect to be enabled for each connection, you must call mysql_options() with the MYSQL_OPT_RECONNECT option after each call to mysql_real_connect(). This is not necessary as of 5.0.19: Call mysql_options() only before mysql_real_connect() as usual.

(from http://dev.mysql.com/doc/refman/5.0/en/mysql-options.html)
[12 Jan 2008 17:56] Valeriy Kravchuk
Maybe we should ask for mysql_option() to return error if called after mysql_real_connect() at least in 6.0+?
[13 Feb 2008 0:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".