Posts: 290
Threads: 30
Thanks Received:
0 in 0 posts
Thanks Given: 0
Joined: Mar 2013
Reputation:
0
Hello,
i want to make some request in my sources code, but i need to connect to mysql.
At the moment, i don't understand that how works the boost mysql query, so i thought to make a simple mysql connection into my code.
This is possible?
Posts: 32
Threads: 3
Thanks Received:
0 in 0 posts
Thanks Given: 0
Joined: Jul 2014
Reputation:
0
#include "../ShareLib/DBCmd.h"
an example with getting ban reasons
bool HWID::BanReasons()
{
CLCString gQuery(1000);
gQuery.Format("SELECT a_reason FROM t_bans");
CDBCmd LCCmd;
LCCmd.Init(&gserver->m_dbdata);
LCCmd.SetQuery(gQuery);
if(!LCCmd.Open())
return false;
m_reason = new int[cmd.m_nrecords];
for(int i = 0; i < LCCmd.m_nrecords; i++)
{
switch(i)
{
case MEMORY_MODIFICATION: // a_reason = 0
m_reason[i] = 0;
case PACKET_SPAM: // a_reason = 1
m_reason[i] = 1;
case FILE_MODIFICATION: // a_reason = 2
m_reason[i] = 2;
}
}
return true;
}
Posts: 290
Threads: 30
Thanks Received:
0 in 0 posts
Thanks Given: 0
Joined: Mar 2013
Reputation:
0
Okay,
but the normal C++ api connection working, i'll make with this at the moment, and when i'll get time i'll make with boost lib
can be closed