Bug #13060 Connection::set_option() is of no effect
Submitted: 8 Sep 2005 11:08 Modified: 8 Sep 2005 11:18
Reporter: lgy lgy Email Updates:
Status: Won't fix Impact on me:
None 
Category:MySQL++ Severity:S3 (Non-critical)
Version:2.0.4 OS:Linux (linux)
Assigned to: CPU Architecture:Any

[8 Sep 2005 11:08] lgy lgy
Description:
It's maybe a bug in mysql++-2.0.4. I fond the Connection::set_option function is of no effect.
At mysql reference manual, the mysql_options() should be called after mysql_init() and before mysql_connect().
But in the Connection::connect() function, the apply_pending_options() function is called after mysql_real_connect().
So i think the right mothed should be,

    // call before mysql_real_connect() 
    apply_pending_options();
    // Establish connection
    if (mysql_real_connect(&mysql_, host, user, passwd, db, port,
 		..........

How to repeat:
i use mysql++ in redhat linux as 4. mysql version is 4.1.10.

    conn.set_option(Connection::opt_init_command, "SET NAMES 'GBK'");
    conn.set_option(Connection::opt_connect_timeout, (unsigned int)20);
    
    class CParam Param;
    conn.connect(Param.getdb(), Param.gethost(), Param.getuser(), Param.getpass());
   
 
    

Suggested fix:
    // call before mysql_real_connect() 
    apply_pending_options();
    // Establish connection
    if (mysql_real_connect(&mysql_, host, user, passwd, db, port,
 		..........
[8 Sep 2005 11:18] MySQL Verification Team
Thank you for the bug report, but currently MySQL++ isn't maintained by
MySQL's developer.