Save fixes

This commit is contained in:
def 2017-05-24 21:32:26 +02:00
parent 1b2a85af58
commit 1f86e6c8df

View file

@ -1496,8 +1496,9 @@ bool CSqlScore::LoadTeamThread(CSqlServer* pSqlServer, const CSqlData *pGameData
try try
{ {
pSqlServer->executeSql("start transaction;");
char aBuf[768]; char aBuf[768];
str_format(aBuf, sizeof(aBuf), "lock tables %s_saves write;", pSqlServer->GetPrefix());
pSqlServer->executeSql("lock tables %s_saves;");
str_format(aBuf, sizeof(aBuf), "select Savegame, Server, UNIX_TIMESTAMP(CURRENT_TIMESTAMP)-UNIX_TIMESTAMP(Timestamp) as Ago from %s_saves where Code = '%s' and Map = '%s';", pSqlServer->GetPrefix(), pData->m_Code.ClrStr(), pData->m_Map.ClrStr()); str_format(aBuf, sizeof(aBuf), "select Savegame, Server, UNIX_TIMESTAMP(CURRENT_TIMESTAMP)-UNIX_TIMESTAMP(Timestamp) as Ago from %s_saves where Code = '%s' and Map = '%s';", pSqlServer->GetPrefix(), pData->m_Code.ClrStr(), pData->m_Map.ClrStr());
pSqlServer->executeSqlQuery(aBuf); pSqlServer->executeSqlQuery(aBuf);
@ -1591,7 +1592,7 @@ bool CSqlScore::LoadTeamThread(CSqlServer* pSqlServer, const CSqlData *pGameData
pData->GameServer()->SendChatTarget(pData->m_ClientID, "No such savegame for this map"); pData->GameServer()->SendChatTarget(pData->m_ClientID, "No such savegame for this map");
end: end:
pSqlServer->executeSql("commit;"); pSqlServer->executeSql("unlock tables;");
return true; return true;
} }
catch (sql::SQLException &e) catch (sql::SQLException &e)