Sqlite doesn't recognize concat() so use || on it instead

This commit is contained in:
Paweł Chmielowski 2019-04-30 18:33:12 +02:00
parent 2562f89005
commit 7eb5a0877b
1 changed files with 8 additions and 2 deletions

View File

@ -425,10 +425,16 @@ make_sql_query(User, LServer, MAMQuery, RSM, ExtraUsernames) ->
[<<" username in (">>, str:join(EscUsers, <<",">>), <<")">>]};
subscribers_table ->
SJid = Escape(jid:encode({User, LServer, <<>>})),
RoomName = case ODBCType of
sqlite ->
<<"room || '@' || host">>;
_ ->
<<"concat(room, '@', host)">>
end,
{<<" username,">>,
[<<" (username = '">>, SUser, <<"'">>,
<<" or username in (select concat(room, '@', host) ",
"from muc_room_subscribers where jid='">>, SJid, <<"'">>, HostMatch, <<"))">>]};
<<" or username in (select ">>, RoomName,
<<" from muc_room_subscribers where jid='">>, SJid, <<"'">>, HostMatch, <<"))">>]};
_ ->
{<<>>, [<<" username='">>, SUser, <<"'">>]}
end,