4,011
社区成员
发帖
与我相关
我的任务
分享
class CDbRepository
{
public:
CDbRepository(void) : m_pQuery(NULL)
{
mysql_library_init(0, NULL, NULL);
mysql_init(&m_Mysql);
Connect();
}
~CDbRepository(void)
{
mysql_close(m_pConnection);
mysql_library_end();
}
BOOL Connect()
{
m_pConnection = mysql_real_connect(&m_Mysql,
"localhost",
"root", "123456",
"ImRoBot2", 3306,
NULL, 0);
if (m_pConnection == NULL)
{
return FALSE;
}
else
{
return TRUE;
}
}
}