![]() |
|
How to use the mysql connection in source code? - Printable Version +- LCKB (https://lckb.dev/forum) +-- Forum: ** OLD LCKB DATABASE ** (https://lckb.dev/forum/forumdisplay.php?fid=109) +--- Forum: Programmers Gateway (https://lckb.dev/forum/forumdisplay.php?fid=196) +---- Forum: Help (https://lckb.dev/forum/forumdisplay.php?fid=205) +---- Thread: How to use the mysql connection in source code? (/showthread.php?tid=4650) |
- WorldOfWars - 02-06-2016 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? - Agility - 02-06-2016 #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; } - WorldOfWars - 02-06-2016 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 |