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,
..........
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, ..........