Use correct type for seconds field in mod_last sql queries

This commit is contained in:
Paweł Chmielowski 2020-03-18 14:02:21 +01:00
parent f12ee28660
commit 0a88d03dc9
1 changed files with 4 additions and 2 deletions

View File

@ -55,10 +55,11 @@ get_last(LUser, LServer) ->
end. end.
store_last_info(LUser, LServer, TimeStamp, Status) -> store_last_info(LUser, LServer, TimeStamp, Status) ->
TS = integer_to_binary(TimeStamp),
case ?SQL_UPSERT(LServer, "last", case ?SQL_UPSERT(LServer, "last",
["!username=%(LUser)s", ["!username=%(LUser)s",
"!server_host=%(LServer)s", "!server_host=%(LServer)s",
"seconds=%(TimeStamp)d", "seconds=%(TS)s",
"state=%(Status)s"]) of "state=%(Status)s"]) of
ok -> ok ->
ok; ok;
@ -76,11 +77,12 @@ export(_Server) ->
fun(Host, #last_activity{us = {LUser, LServer}, fun(Host, #last_activity{us = {LUser, LServer},
timestamp = TimeStamp, status = Status}) timestamp = TimeStamp, status = Status})
when LServer == Host -> when LServer == Host ->
TS = integer_to_binary(TimeStamp),
[?SQL("delete from last where username=%(LUser)s and %(LServer)H;"), [?SQL("delete from last where username=%(LUser)s and %(LServer)H;"),
?SQL_INSERT("last", ?SQL_INSERT("last",
["username=%(LUser)s", ["username=%(LUser)s",
"server_host=%(LServer)s", "server_host=%(LServer)s",
"seconds=%(TimeStamp)d", "seconds=%(TS)s",
"state=%(Status)s"])]; "state=%(Status)s"])];
(_Host, _R) -> (_Host, _R) ->
[] []