65,186
社区成员




struct test_struct
{
MYSQL fuck_mysql;
int fuck_int;
};
void foo()
{
test_struct ts;
ts.fuck_int = 0;
if (!mysql_init(&ts.fuck_mysql))
{
cout << "mysql_init error. ret:" << string(mysql_error(&ts.fuck_mysql)) << endl;
}
if (!mysql_real_connect(&ts.fuck_mysql,
"192.168.111.120",
"root",
"123",
0,
3306, NULL, 0))
{
cout << "mysql_real_connect error. ret:" << string(mysql_error(&ts.fuck_mysql)) << endl;
}
cout << "ts.fuck_int:" << ts.fuck_int << endl;
cout << "-----------------------------------分隔线-----------------------------------------------" << endl;
int before = 0;
MYSQL connection;
int after = 0;
if (!mysql_init(&connection))
{
cout << "mysql_init error. ret:" << string(mysql_error(&connection)) << endl;
}
if (!mysql_real_connect(&connection,
"192.168.111.120",
"root",
"123",
0,
3306, NULL, 0))
{
cout << "mysql_real_connect error. ret:" << string(mysql_error(&connection)) << endl;
}
cout << "before:" << before << endl;
cout << "after:" << after << endl;
}