mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-14 03:58:18 +00:00
fixed use of locks for threading:
each sqlserver has its own lock now -> it is required that every connect call is followed by a disconnect call
This commit is contained in:
parent
15f2e07c48
commit
c4ab59e4c3
|
@ -14,8 +14,6 @@
|
||||||
#include "../gamemodes/DDRace.h"
|
#include "../gamemodes/DDRace.h"
|
||||||
#include "../save.h"
|
#include "../save.h"
|
||||||
|
|
||||||
static LOCK gs_SqlLock = 0;
|
|
||||||
|
|
||||||
CGameContext *CSqlData::ms_pGameServer = 0;
|
CGameContext *CSqlData::ms_pGameServer = 0;
|
||||||
IServer *CSqlData::ms_pServer = 0;
|
IServer *CSqlData::ms_pServer = 0;
|
||||||
CPlayerData *CSqlData::ms_pPlayerData = 0;
|
CPlayerData *CSqlData::ms_pPlayerData = 0;
|
||||||
|
@ -36,18 +34,9 @@ CSqlScore::CSqlScore(CGameContext *pGameServer) : m_pGameServer(pGameServer),
|
||||||
CSqlData::ms_pSqlServer = SqlServer();
|
CSqlData::ms_pSqlServer = SqlServer();
|
||||||
CSqlData::ms_pMasterSqlServers = SqlMasterServers();
|
CSqlData::ms_pMasterSqlServers = SqlMasterServers();
|
||||||
|
|
||||||
if(gs_SqlLock == 0)
|
|
||||||
gs_SqlLock = lock_create();
|
|
||||||
|
|
||||||
Init();
|
Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
CSqlScore::~CSqlScore()
|
|
||||||
{
|
|
||||||
lock_wait(gs_SqlLock);
|
|
||||||
lock_unlock(gs_SqlLock);
|
|
||||||
}
|
|
||||||
|
|
||||||
// create tables... should be done only once
|
// create tables... should be done only once
|
||||||
void CSqlScore::Init()
|
void CSqlScore::Init()
|
||||||
{
|
{
|
||||||
|
@ -84,8 +73,6 @@ void CSqlScore::Init()
|
||||||
// update stuff
|
// update stuff
|
||||||
void CSqlScore::LoadScoreThread(void *pUser)
|
void CSqlScore::LoadScoreThread(void *pUser)
|
||||||
{
|
{
|
||||||
lock_wait(gs_SqlLock);
|
|
||||||
|
|
||||||
CSqlScoreData *pData = (CSqlScoreData *)pUser;
|
CSqlScoreData *pData = (CSqlScoreData *)pUser;
|
||||||
|
|
||||||
// Connect to database
|
// Connect to database
|
||||||
|
@ -133,10 +120,7 @@ void CSqlScore::LoadScoreThread(void *pUser)
|
||||||
// disconnect from database
|
// disconnect from database
|
||||||
pData->SqlServer()->Disconnect();
|
pData->SqlServer()->Disconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
delete pData;
|
delete pData;
|
||||||
|
|
||||||
lock_unlock(gs_SqlLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSqlScore::LoadScore(int ClientID)
|
void CSqlScore::LoadScore(int ClientID)
|
||||||
|
@ -151,8 +135,6 @@ void CSqlScore::LoadScore(int ClientID)
|
||||||
|
|
||||||
void CSqlScore::SaveTeamScoreThread(void *pUser)
|
void CSqlScore::SaveTeamScoreThread(void *pUser)
|
||||||
{
|
{
|
||||||
lock_wait(gs_SqlLock);
|
|
||||||
|
|
||||||
CSqlTeamScoreData *pData = (CSqlTeamScoreData *)pUser;
|
CSqlTeamScoreData *pData = (CSqlTeamScoreData *)pUser;
|
||||||
|
|
||||||
// Connect to database
|
// Connect to database
|
||||||
|
@ -270,8 +252,6 @@ void CSqlScore::SaveTeamScoreThread(void *pUser)
|
||||||
dbg_msg("SQL", "ERROR: Could not connect to SQL-Server");
|
dbg_msg("SQL", "ERROR: Could not connect to SQL-Server");
|
||||||
|
|
||||||
delete pData;
|
delete pData;
|
||||||
|
|
||||||
lock_unlock(gs_SqlLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSqlScore::MapVote(int ClientID, const char* MapName)
|
void CSqlScore::MapVote(int ClientID, const char* MapName)
|
||||||
|
@ -286,8 +266,6 @@ void CSqlScore::MapVote(int ClientID, const char* MapName)
|
||||||
|
|
||||||
void CSqlScore::MapVoteThread(void *pUser)
|
void CSqlScore::MapVoteThread(void *pUser)
|
||||||
{
|
{
|
||||||
lock_wait(gs_SqlLock);
|
|
||||||
|
|
||||||
CSqlMapData *pData = (CSqlMapData *)pUser;
|
CSqlMapData *pData = (CSqlMapData *)pUser;
|
||||||
|
|
||||||
// Connect to database
|
// Connect to database
|
||||||
|
@ -366,9 +344,7 @@ void CSqlScore::MapVoteThread(void *pUser)
|
||||||
|
|
||||||
pData->SqlServer()->Disconnect();
|
pData->SqlServer()->Disconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
delete pData;
|
delete pData;
|
||||||
lock_unlock(gs_SqlLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSqlScore::MapInfo(int ClientID, const char* MapName)
|
void CSqlScore::MapInfo(int ClientID, const char* MapName)
|
||||||
|
@ -383,8 +359,6 @@ void CSqlScore::MapInfo(int ClientID, const char* MapName)
|
||||||
|
|
||||||
void CSqlScore::MapInfoThread(void *pUser)
|
void CSqlScore::MapInfoThread(void *pUser)
|
||||||
{
|
{
|
||||||
lock_wait(gs_SqlLock);
|
|
||||||
|
|
||||||
CSqlMapData *pData = (CSqlMapData *)pUser;
|
CSqlMapData *pData = (CSqlMapData *)pUser;
|
||||||
|
|
||||||
// Connect to database
|
// Connect to database
|
||||||
|
@ -465,15 +439,11 @@ void CSqlScore::MapInfoThread(void *pUser)
|
||||||
|
|
||||||
pData->SqlServer()->Disconnect();
|
pData->SqlServer()->Disconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
delete pData;
|
delete pData;
|
||||||
lock_unlock(gs_SqlLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSqlScore::SaveScoreThread(void *pUser)
|
void CSqlScore::SaveScoreThread(void *pUser)
|
||||||
{
|
{
|
||||||
lock_wait(gs_SqlLock);
|
|
||||||
|
|
||||||
CSqlScoreData *pData = (CSqlScoreData *)pUser;
|
CSqlScoreData *pData = (CSqlScoreData *)pUser;
|
||||||
|
|
||||||
// Connect to database
|
// Connect to database
|
||||||
|
@ -532,8 +502,6 @@ void CSqlScore::SaveScoreThread(void *pUser)
|
||||||
dbg_msg("SQL", "ERROR: Could not connect to SQL-Server");
|
dbg_msg("SQL", "ERROR: Could not connect to SQL-Server");
|
||||||
|
|
||||||
delete pData;
|
delete pData;
|
||||||
|
|
||||||
lock_unlock(gs_SqlLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSqlScore::SaveScore(int ClientID, float Time, float CpTime[NUM_CHECKPOINTS])
|
void CSqlScore::SaveScore(int ClientID, float Time, float CpTime[NUM_CHECKPOINTS])
|
||||||
|
@ -572,8 +540,6 @@ void CSqlScore::SaveTeamScore(int* aClientIDs, unsigned int Size, float Time)
|
||||||
|
|
||||||
void CSqlScore::ShowTeamRankThread(void *pUser)
|
void CSqlScore::ShowTeamRankThread(void *pUser)
|
||||||
{
|
{
|
||||||
lock_wait(gs_SqlLock);
|
|
||||||
|
|
||||||
CSqlScoreData *pData = (CSqlScoreData *)pUser;
|
CSqlScoreData *pData = (CSqlScoreData *)pUser;
|
||||||
|
|
||||||
// Connect to database
|
// Connect to database
|
||||||
|
@ -648,14 +614,10 @@ void CSqlScore::ShowTeamRankThread(void *pUser)
|
||||||
}
|
}
|
||||||
|
|
||||||
delete pData;
|
delete pData;
|
||||||
|
|
||||||
lock_unlock(gs_SqlLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSqlScore::ShowTeamTop5Thread(void *pUser)
|
void CSqlScore::ShowTeamTop5Thread(void *pUser)
|
||||||
{
|
{
|
||||||
lock_wait(gs_SqlLock);
|
|
||||||
|
|
||||||
CSqlScoreData *pData = (CSqlScoreData *)pUser;
|
CSqlScoreData *pData = (CSqlScoreData *)pUser;
|
||||||
|
|
||||||
// Connect to database
|
// Connect to database
|
||||||
|
@ -747,14 +709,10 @@ void CSqlScore::ShowTeamTop5Thread(void *pUser)
|
||||||
}
|
}
|
||||||
|
|
||||||
delete pData;
|
delete pData;
|
||||||
|
|
||||||
lock_unlock(gs_SqlLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSqlScore::ShowRankThread(void *pUser)
|
void CSqlScore::ShowRankThread(void *pUser)
|
||||||
{
|
{
|
||||||
lock_wait(gs_SqlLock);
|
|
||||||
|
|
||||||
CSqlScoreData *pData = (CSqlScoreData *)pUser;
|
CSqlScoreData *pData = (CSqlScoreData *)pUser;
|
||||||
|
|
||||||
// Connect to database
|
// Connect to database
|
||||||
|
@ -811,8 +769,6 @@ void CSqlScore::ShowRankThread(void *pUser)
|
||||||
}
|
}
|
||||||
|
|
||||||
delete pData;
|
delete pData;
|
||||||
|
|
||||||
lock_unlock(gs_SqlLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSqlScore::ShowTeamRank(int ClientID, const char* pName, bool Search)
|
void CSqlScore::ShowTeamRank(int ClientID, const char* pName, bool Search)
|
||||||
|
@ -841,8 +797,6 @@ void CSqlScore::ShowRank(int ClientID, const char* pName, bool Search)
|
||||||
|
|
||||||
void CSqlScore::ShowTop5Thread(void *pUser)
|
void CSqlScore::ShowTop5Thread(void *pUser)
|
||||||
{
|
{
|
||||||
lock_wait(gs_SqlLock);
|
|
||||||
|
|
||||||
CSqlScoreData *pData = (CSqlScoreData *)pUser;
|
CSqlScoreData *pData = (CSqlScoreData *)pUser;
|
||||||
|
|
||||||
// Connect to database
|
// Connect to database
|
||||||
|
@ -886,15 +840,11 @@ void CSqlScore::ShowTop5Thread(void *pUser)
|
||||||
// disconnect from database
|
// disconnect from database
|
||||||
pData->SqlServer()->Disconnect();
|
pData->SqlServer()->Disconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
delete pData;
|
delete pData;
|
||||||
|
|
||||||
lock_unlock(gs_SqlLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSqlScore::ShowTimesThread(void *pUser)
|
void CSqlScore::ShowTimesThread(void *pUser)
|
||||||
{
|
{
|
||||||
lock_wait(gs_SqlLock);
|
|
||||||
CSqlScoreData *pData = (CSqlScoreData *)pUser;
|
CSqlScoreData *pData = (CSqlScoreData *)pUser;
|
||||||
|
|
||||||
// Connect to database
|
// Connect to database
|
||||||
|
@ -970,8 +920,6 @@ void CSqlScore::ShowTimesThread(void *pUser)
|
||||||
pData->SqlServer()->Disconnect();
|
pData->SqlServer()->Disconnect();
|
||||||
}
|
}
|
||||||
delete pData;
|
delete pData;
|
||||||
|
|
||||||
lock_unlock(gs_SqlLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSqlScore::ShowTeamTop5(IConsole::IResult *pResult, int ClientID, void *pUserData, int Debut)
|
void CSqlScore::ShowTeamTop5(IConsole::IResult *pResult, int ClientID, void *pUserData, int Debut)
|
||||||
|
@ -1019,8 +967,6 @@ void CSqlScore::ShowTimes(int ClientID, const char* pName, int Debut)
|
||||||
|
|
||||||
void CSqlScore::ShowPointsThread(void *pUser)
|
void CSqlScore::ShowPointsThread(void *pUser)
|
||||||
{
|
{
|
||||||
lock_wait(gs_SqlLock);
|
|
||||||
|
|
||||||
CSqlScoreData *pData = (CSqlScoreData *)pUser;
|
CSqlScoreData *pData = (CSqlScoreData *)pUser;
|
||||||
|
|
||||||
// Connect to database
|
// Connect to database
|
||||||
|
@ -1070,8 +1016,6 @@ void CSqlScore::ShowPointsThread(void *pUser)
|
||||||
}
|
}
|
||||||
|
|
||||||
delete pData;
|
delete pData;
|
||||||
|
|
||||||
lock_unlock(gs_SqlLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSqlScore::ShowPoints(int ClientID, const char* pName, bool Search)
|
void CSqlScore::ShowPoints(int ClientID, const char* pName, bool Search)
|
||||||
|
@ -1088,8 +1032,6 @@ void CSqlScore::ShowPoints(int ClientID, const char* pName, bool Search)
|
||||||
|
|
||||||
void CSqlScore::ShowTopPointsThread(void *pUser)
|
void CSqlScore::ShowTopPointsThread(void *pUser)
|
||||||
{
|
{
|
||||||
lock_wait(gs_SqlLock);
|
|
||||||
|
|
||||||
CSqlScoreData *pData = (CSqlScoreData *)pUser;
|
CSqlScoreData *pData = (CSqlScoreData *)pUser;
|
||||||
|
|
||||||
// Connect to database
|
// Connect to database
|
||||||
|
@ -1130,8 +1072,6 @@ void CSqlScore::ShowTopPointsThread(void *pUser)
|
||||||
}
|
}
|
||||||
|
|
||||||
delete pData;
|
delete pData;
|
||||||
|
|
||||||
lock_unlock(gs_SqlLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSqlScore::ShowTopPoints(IConsole::IResult *pResult, int ClientID, void *pUserData, int Debut)
|
void CSqlScore::ShowTopPoints(IConsole::IResult *pResult, int ClientID, void *pUserData, int Debut)
|
||||||
|
@ -1146,8 +1086,6 @@ void CSqlScore::ShowTopPoints(IConsole::IResult *pResult, int ClientID, void *pU
|
||||||
|
|
||||||
void CSqlScore::RandomMapThread(void *pUser)
|
void CSqlScore::RandomMapThread(void *pUser)
|
||||||
{
|
{
|
||||||
lock_wait(gs_SqlLock);
|
|
||||||
|
|
||||||
CSqlScoreData *pData = (CSqlScoreData *)pUser;
|
CSqlScoreData *pData = (CSqlScoreData *)pUser;
|
||||||
|
|
||||||
// Connect to database
|
// Connect to database
|
||||||
|
@ -1191,14 +1129,10 @@ void CSqlScore::RandomMapThread(void *pUser)
|
||||||
}
|
}
|
||||||
|
|
||||||
delete pData;
|
delete pData;
|
||||||
|
|
||||||
lock_unlock(gs_SqlLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSqlScore::RandomUnfinishedMapThread(void *pUser)
|
void CSqlScore::RandomUnfinishedMapThread(void *pUser)
|
||||||
{
|
{
|
||||||
lock_wait(gs_SqlLock);
|
|
||||||
|
|
||||||
CSqlScoreData *pData = (CSqlScoreData *)pUser;
|
CSqlScoreData *pData = (CSqlScoreData *)pUser;
|
||||||
|
|
||||||
// Connect to database
|
// Connect to database
|
||||||
|
@ -1246,8 +1180,6 @@ void CSqlScore::RandomUnfinishedMapThread(void *pUser)
|
||||||
}
|
}
|
||||||
|
|
||||||
delete pData;
|
delete pData;
|
||||||
|
|
||||||
lock_unlock(gs_SqlLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSqlScore::RandomMap(int ClientID, int stars)
|
void CSqlScore::RandomMap(int ClientID, int stars)
|
||||||
|
@ -1340,7 +1272,6 @@ void CSqlScore::SaveTeamThread(void *pUser)
|
||||||
else
|
else
|
||||||
pData->GameServer()->SendChatTarget(pData->m_ClientID, "You have to be in a Team (from 1-63)");
|
pData->GameServer()->SendChatTarget(pData->m_ClientID, "You have to be in a Team (from 1-63)");
|
||||||
|
|
||||||
lock_wait(gs_SqlLock);
|
|
||||||
// Connect to database
|
// Connect to database
|
||||||
if(!Num && pData->SqlServer()->Connect())
|
if(!Num && pData->SqlServer()->Connect())
|
||||||
{
|
{
|
||||||
|
@ -1391,8 +1322,6 @@ void CSqlScore::SaveTeamThread(void *pUser)
|
||||||
delete pData;
|
delete pData;
|
||||||
if(SavedTeam)
|
if(SavedTeam)
|
||||||
delete SavedTeam;
|
delete SavedTeam;
|
||||||
|
|
||||||
lock_unlock(gs_SqlLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSqlScore::LoadTeam(const char* Code, int ClientID)
|
void CSqlScore::LoadTeam(const char* Code, int ClientID)
|
||||||
|
@ -1418,7 +1347,6 @@ void CSqlScore::LoadTeamThread(void *pUser)
|
||||||
ClearString(Map, sizeof(Map));
|
ClearString(Map, sizeof(Map));
|
||||||
int Num;
|
int Num;
|
||||||
|
|
||||||
lock_wait(gs_SqlLock);
|
|
||||||
// Connect to database
|
// Connect to database
|
||||||
if(pData->SqlServer()->Connect())
|
if(pData->SqlServer()->Connect())
|
||||||
{
|
{
|
||||||
|
@ -1532,8 +1460,6 @@ void CSqlScore::LoadTeamThread(void *pUser)
|
||||||
|
|
||||||
delete pData;
|
delete pData;
|
||||||
delete SavedTeam;
|
delete SavedTeam;
|
||||||
|
|
||||||
lock_unlock(gs_SqlLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -14,6 +14,7 @@ class CSqlScore: public IScore
|
||||||
CGameContext *GameServer() { return m_pGameServer; }
|
CGameContext *GameServer() { return m_pGameServer; }
|
||||||
IServer *Server() { return m_pServer; }
|
IServer *Server() { return m_pServer; }
|
||||||
inline CSqlServer *SqlServer() { return m_pServer->SqlServer(); }
|
inline CSqlServer *SqlServer() { return m_pServer->SqlServer(); }
|
||||||
|
inline CSqlServer *SqlMasterServer(int i) { return m_pServer->SqlMasterServers()[i]; }
|
||||||
inline CSqlServer **SqlMasterServers() { return m_pServer->SqlMasterServers(); }
|
inline CSqlServer **SqlMasterServers() { return m_pServer->SqlMasterServers(); }
|
||||||
|
|
||||||
void Init();
|
void Init();
|
||||||
|
@ -43,7 +44,6 @@ class CSqlScore: public IScore
|
||||||
public:
|
public:
|
||||||
|
|
||||||
CSqlScore(CGameContext *pGameServer);
|
CSqlScore(CGameContext *pGameServer);
|
||||||
~CSqlScore();
|
|
||||||
|
|
||||||
virtual void LoadScore(int ClientID);
|
virtual void LoadScore(int ClientID);
|
||||||
virtual void MapInfo(int ClientID, const char* MapName);
|
virtual void MapInfo(int ClientID, const char* MapName);
|
||||||
|
|
|
@ -20,10 +20,13 @@ CSqlServer::CSqlServer(const char* pDatabase, const char* pPrefix, const char* p
|
||||||
m_pConnection = 0;
|
m_pConnection = 0;
|
||||||
m_pResults = 0;
|
m_pResults = 0;
|
||||||
m_pStatement = 0;
|
m_pStatement = 0;
|
||||||
|
|
||||||
|
m_SqlLock = lock_create();
|
||||||
}
|
}
|
||||||
|
|
||||||
CSqlServer::~CSqlServer()
|
CSqlServer::~CSqlServer()
|
||||||
{
|
{
|
||||||
|
Lock();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (m_pResults)
|
if (m_pResults)
|
||||||
|
@ -36,10 +39,13 @@ CSqlServer::~CSqlServer()
|
||||||
{
|
{
|
||||||
dbg_msg("SQL", "ERROR: No SQL connection");
|
dbg_msg("SQL", "ERROR: No SQL connection");
|
||||||
}
|
}
|
||||||
|
UnLock();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSqlServer::Connect(bool CreateDatabase)
|
bool CSqlServer::Connect(bool CreateDatabase)
|
||||||
{
|
{
|
||||||
|
Lock();
|
||||||
|
|
||||||
if (m_pDriver != NULL && m_pConnection != NULL)
|
if (m_pDriver != NULL && m_pConnection != NULL)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -54,6 +60,7 @@ bool CSqlServer::Connect(bool CreateDatabase)
|
||||||
dbg_msg("SQL", aBuf);
|
dbg_msg("SQL", aBuf);
|
||||||
|
|
||||||
dbg_msg("SQL", "ERROR: SQL connection failed");
|
dbg_msg("SQL", "ERROR: SQL connection failed");
|
||||||
|
UnLock();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -99,6 +106,7 @@ bool CSqlServer::Connect(bool CreateDatabase)
|
||||||
dbg_msg("SQL", aBuf);
|
dbg_msg("SQL", aBuf);
|
||||||
|
|
||||||
dbg_msg("SQL", "ERROR: SQL connection failed");
|
dbg_msg("SQL", "ERROR: SQL connection failed");
|
||||||
|
UnLock();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
catch (const std::exception& ex)
|
catch (const std::exception& ex)
|
||||||
|
@ -135,14 +143,16 @@ bool CSqlServer::Connect(bool CreateDatabase)
|
||||||
dbg_msg("SQL", "Unknown Error cause by the MySQL/C++ Connector, my advice compile server_debug and use it");
|
dbg_msg("SQL", "Unknown Error cause by the MySQL/C++ Connector, my advice compile server_debug and use it");
|
||||||
|
|
||||||
dbg_msg("SQL", "ERROR: SQL connection failed");
|
dbg_msg("SQL", "ERROR: SQL connection failed");
|
||||||
|
UnLock();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
UnLock();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSqlServer::Disconnect()
|
void CSqlServer::Disconnect()
|
||||||
{
|
{
|
||||||
|
UnLock();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSqlServer::CreateTables()
|
void CSqlServer::CreateTables()
|
||||||
|
|
|
@ -34,6 +34,9 @@ public:
|
||||||
const char* GetIP() { return m_aIp; }
|
const char* GetIP() { return m_aIp; }
|
||||||
int GetPort() { return m_Port; }
|
int GetPort() { return m_Port; }
|
||||||
|
|
||||||
|
void Lock() { lock_wait(m_SqlLock); }
|
||||||
|
void UnLock() { lock_unlock(m_SqlLock); }
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
sql::Driver *m_pDriver;
|
sql::Driver *m_pDriver;
|
||||||
|
@ -48,6 +51,8 @@ private:
|
||||||
char m_aPass[64];
|
char m_aPass[64];
|
||||||
char m_aIp[64];
|
char m_aIp[64];
|
||||||
int m_Port;
|
int m_Port;
|
||||||
|
|
||||||
|
LOCK m_SqlLock;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue