mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 14:38:18 +00:00
Fix updating teamranks
This commit is contained in:
parent
ebe9024a66
commit
b7205f5ef5
|
@ -1,4 +1,5 @@
|
||||||
#include "scoreworker.h"
|
#include "scoreworker.h"
|
||||||
|
#include "base/system.h"
|
||||||
|
|
||||||
#include <engine/server/databases/connection.h>
|
#include <engine/server/databases/connection.h>
|
||||||
#include <engine/server/databases/connection_pool.h>
|
#include <engine/server/databases/connection_pool.h>
|
||||||
|
@ -640,23 +641,23 @@ bool CScoreWorker::SaveTeamScore(IDbConnection *pSqlServer, const ISqlData *pGam
|
||||||
if(pData->m_Time < Time)
|
if(pData->m_Time < Time)
|
||||||
{
|
{
|
||||||
str_format(aBuf, sizeof(aBuf),
|
str_format(aBuf, sizeof(aBuf),
|
||||||
"UPDATE %s_teamrace SET Time=%.2f, Timestamp=?, DDNet7=%s, GameID=? WHERE ID = ?",
|
"UPDATE %s_teamrace SET Time=%.2f, Timestamp=%s, DDNet7=%s, GameID=? WHERE ID = ?",
|
||||||
pSqlServer->GetPrefix(), pData->m_Time, pSqlServer->False());
|
pSqlServer->GetPrefix(), pData->m_Time, pSqlServer->InsertTimestampAsUtc(), pSqlServer->False());
|
||||||
if(pSqlServer->PrepareStatement(aBuf, pError, ErrorSize))
|
if(pSqlServer->PrepareStatement(aBuf, pError, ErrorSize))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
pSqlServer->BindString(1, pData->m_aTimestamp);
|
pSqlServer->BindString(1, pData->m_aTimestamp);
|
||||||
pSqlServer->BindString(2, pData->m_aGameUuid);
|
pSqlServer->BindString(2, pData->m_aGameUuid);
|
||||||
// copy uuid, because mysql BindBlob doesn't support const buffers
|
pSqlServer->BindBlob(3, Teamrank.m_TeamID.m_aData, sizeof(Teamrank.m_TeamID.m_aData));
|
||||||
CUuid TeamrankId = pData->m_TeamrankUuid;
|
|
||||||
pSqlServer->BindBlob(3, TeamrankId.m_aData, sizeof(TeamrankId.m_aData));
|
|
||||||
pSqlServer->Print();
|
pSqlServer->Print();
|
||||||
int NumUpdated;
|
int NumUpdated;
|
||||||
if(pSqlServer->ExecuteUpdate(&NumUpdated, pError, ErrorSize))
|
if(pSqlServer->ExecuteUpdate(&NumUpdated, pError, ErrorSize))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
// return error if we didn't update any rows
|
||||||
|
return NumUpdated == 0;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue