diff options
author | Paweł Chmielowski <pchmielowski@process-one.net> | 2020-03-18 14:02:21 +0100 |
---|---|---|
committer | Paweł Chmielowski <pchmielowski@process-one.net> | 2020-03-18 14:05:05 +0100 |
commit | 0a88d03dc980cbf3a59fed437388d9b33567d30b (patch) | |
tree | 5d213ced71c2b763053dc72b9b8593619caf11e7 | |
parent | Change conversion of boolean values for cockroachdb (diff) |
Use correct type for seconds field in mod_last sql queries
-rw-r--r-- | src/mod_last_sql.erl | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/mod_last_sql.erl b/src/mod_last_sql.erl index 0e8c39f8b..095cf001a 100644 --- a/src/mod_last_sql.erl +++ b/src/mod_last_sql.erl @@ -55,10 +55,11 @@ get_last(LUser, LServer) -> end. store_last_info(LUser, LServer, TimeStamp, Status) -> + TS = integer_to_binary(TimeStamp), case ?SQL_UPSERT(LServer, "last", ["!username=%(LUser)s", "!server_host=%(LServer)s", - "seconds=%(TimeStamp)d", + "seconds=%(TS)s", "state=%(Status)s"]) of ok -> ok; @@ -76,11 +77,12 @@ export(_Server) -> fun(Host, #last_activity{us = {LUser, LServer}, timestamp = TimeStamp, status = Status}) when LServer == Host -> + TS = integer_to_binary(TimeStamp), [?SQL("delete from last where username=%(LUser)s and %(LServer)H;"), ?SQL_INSERT("last", ["username=%(LUser)s", "server_host=%(LServer)s", - "seconds=%(TimeStamp)d", + "seconds=%(TS)s", "state=%(Status)s"])]; (_Host, _R) -> [] |