Improved SQL statements #219

This commit is contained in:
Sven Heidemann 2023-02-21 21:08:51 +01:00
parent d42b76ba87
commit f7dc8d135a
3 changed files with 6 additions and 3 deletions

View File

@ -118,7 +118,8 @@ class UserJoinedGameServer(TableABC):
return str( return str(
f""" f"""
UPDATE `UserJoinedGameServer` UPDATE `UserJoinedGameServer`
{"SET " if self._leaved_on is None else f"`LeavedOn` = '{self._leaved_on}',"} SET
{"" if self._leaved_on is None else f"`LeavedOn` = '{self._leaved_on}',"}
`LastModifiedAt` = '{self._modified_at}' `LastModifiedAt` = '{self._modified_at}'
WHERE `Id` = {self._id}; WHERE `Id` = {self._id};
""" """

View File

@ -116,7 +116,8 @@ class UserJoinedServer(TableABC):
return str( return str(
f""" f"""
UPDATE `UserJoinedServers` UPDATE `UserJoinedServers`
{"SET " if self._leaved_on is None else f"`LeavedOn` = '{self._leaved_on}',"} SET
{"" if self._leaved_on is None else f"`LeavedOn` = '{self._leaved_on}',"}
`LastModifiedAt` = '{self._modified_at}' `LastModifiedAt` = '{self._modified_at}'
WHERE `UserId` = {self._user.id}; WHERE `UserId` = {self._user.id};
""" """

View File

@ -125,7 +125,8 @@ class UserJoinedVoiceChannel(TableABC):
return str( return str(
f""" f"""
UPDATE `UserJoinedVoiceChannel` UPDATE `UserJoinedVoiceChannel`
{"SET " if self._leaved_on is None else f"`LeavedOn` = '{self._leaved_on}',"} SET
{"" if self._leaved_on is None else f"`LeavedOn` = '{self._leaved_on}',"}
`LastModifiedAt` = '{self._modified_at}' `LastModifiedAt` = '{self._modified_at}'
WHERE `JoinId` = {self._join_id}; WHERE `JoinId` = {self._join_id};
""" """