24
1
mirror of https://github.com/processone/ejabberd.git synced 2024-05-31 21:07:55 +02:00

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

View File

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