Fixed db null handling #219 #229
@ -106,7 +106,7 @@ class UserJoinedGameServer(TableABC):
|
||||
{self._user.id},
|
||||
'{self._game_server}',
|
||||
'{self._joined_on}',
|
||||
{"" if self._leaved_on is None else f"'{self._leaved_on}',"}
|
||||
{"" if self._leaved_on is None else f"'{self._leaved_on}',"}
|
||||
'{self._created_at}',
|
||||
'{self._modified_at}'
|
||||
);
|
||||
@ -118,8 +118,8 @@ class UserJoinedGameServer(TableABC):
|
||||
return str(
|
||||
f"""
|
||||
UPDATE `UserJoinedGameServer`
|
||||
Ebola-Chan marked this conversation as resolved
|
||||
{"" if self._leaved_on is None else f"SET `LeavedOn` = '{self._leaved_on}',"}
|
||||
{"SET " if self._leaved_on is None else ""}`LastModifiedAt` = '{self._modified_at}'
|
||||
{"SET " if self._leaved_on is None else f"`LeavedOn` = '{self._leaved_on}',"}
|
||||
Ebola-Chan
commented
Wenn
Welches durch das fehlende Wenn ```self._leaved_on``` nicht none ist, käme es hier nicht zum folgenden SQL-Statement:
```sql
UPDATE `UserJoinedGameServer`
`LeavedOn' = '20230221T20:58.000'
`LastModifiedAt` = '20230221T20:58.000'
WHERE `Id` = 1;
```
Welches durch das fehlende ```SET``` nicht ausgeführt werden kann?
|
||||
`LastModifiedAt` = '{self._modified_at}'
|
||||
WHERE `Id` = {self._id};
|
||||
"""
|
||||
)
|
||||
|
@ -116,8 +116,8 @@ class UserJoinedServer(TableABC):
|
||||
return str(
|
||||
f"""
|
||||
UPDATE `UserJoinedServers`
|
||||
{"" if self._leaved_on is None else f"SET `LeavedOn` = '{self._leaved_on}',"}
|
||||
{"SET " if self._leaved_on is None else ""}`LastModifiedAt` = '{self._modified_at}'
|
||||
{"SET " if self._leaved_on is None else f"`LeavedOn` = '{self._leaved_on}',"}
|
||||
Ebola-Chan
commented
Auch hier das SQL-Statement so implementieren für bessere Wartbarkeit. Auch hier das SQL-Statement so implementieren für bessere Wartbarkeit.
Ebola-Chan
commented
Auch hier das SET-Problem Auch hier das SET-Problem
|
||||
`LastModifiedAt` = '{self._modified_at}'
|
||||
WHERE `UserId` = {self._user.id};
|
||||
"""
|
||||
)
|
||||
|
@ -125,8 +125,8 @@ class UserJoinedVoiceChannel(TableABC):
|
||||
return str(
|
||||
f"""
|
||||
UPDATE `UserJoinedVoiceChannel`
|
||||
{"" if self._leaved_on is None else f"SET `LeavedOn` = '{self._leaved_on}',"}
|
||||
{"SET " if self._leaved_on is None else ""}`LastModifiedAt` = '{self._modified_at}'
|
||||
{"SET " if self._leaved_on is None else f"`LeavedOn` = '{self._leaved_on}',"}
|
||||
Ebola-Chan
commented
Auch hier das SQL-Statement so implementieren für bessere Wartbarkeit. Auch hier das SQL-Statement so implementieren für bessere Wartbarkeit.
Ebola-Chan
commented
Auch hier das SET-Problem Auch hier das SET-Problem
|
||||
`LastModifiedAt` = '{self._modified_at}'
|
||||
WHERE `JoinId` = {self._join_id};
|
||||
"""
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user
Wie wäre es hier mit:
Somit wäre das SQL-Statement besser wartbar, sollte neue Variablen dazu kommen, welche Nullwerte beinhalten könnten.