6197: Fix teamranks not getting removed or moved out of _backup table r=heinrich5991 a=Zwelf

Fixes #6194

## Checklist

- [x] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Zwelf <zwelf@strct.cc>
This commit is contained in:
bors[bot] 2022-12-26 11:06:16 +00:00 committed by GitHub
commit e1de476fa2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -548,7 +548,7 @@ bool CScoreWorker::SaveTeamScore(IDbConnection *pSqlServer, const ISqlData *pGam
if(w == Write::NORMAL_SUCCEEDED)
{
str_format(aBuf, sizeof(aBuf),
"DELETE FROM %s_teamrace_backup WHERE GameId=?",
"DELETE FROM %s_teamrace_backup WHERE ID=?",
pSqlServer->GetPrefix());
if(pSqlServer->PrepareStatement(aBuf, pError, ErrorSize))
{
@ -576,7 +576,7 @@ bool CScoreWorker::SaveTeamScore(IDbConnection *pSqlServer, const ISqlData *pGam
CUuid TeamrankId = pData->m_TeamrankUuid;
str_format(aBuf, sizeof(aBuf),
"INSERT INTO %s_teamrace SELECT * FROM %s_teamrace_backup WHERE GameId=?",
"INSERT INTO %s_teamrace SELECT * FROM %s_teamrace_backup WHERE ID=?",
pSqlServer->GetPrefix(), pSqlServer->GetPrefix());
if(pSqlServer->PrepareStatement(aBuf, pError, ErrorSize))
{
@ -590,7 +590,7 @@ bool CScoreWorker::SaveTeamScore(IDbConnection *pSqlServer, const ISqlData *pGam
}
str_format(aBuf, sizeof(aBuf),
"DELETE FROM %s_teamrace_backup WHERE GameId=?",
"DELETE FROM %s_teamrace_backup WHERE ID=?",
pSqlServer->GetPrefix());
if(pSqlServer->PrepareStatement(aBuf, pError, ErrorSize))
{