25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-24 16:23:40 +01:00

Make SQL query more generic for MSSQL compatibility (#3271)

This commit is contained in:
yuriyz-w 2020-05-15 10:19:55 +03:00 committed by GitHub
parent 4580feaa3c
commit 44528d3fef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -897,12 +897,12 @@ select_affiliation_subscriptions(Nidx, GenKey, SubKey) ->
GJ = encode_jid(GenKey),
SJ = encode_jid(SubKey),
case catch ejabberd_sql:sql_query_t(
?SQL("select jid = %(GJ)s as @(G)b, @(affiliation)s, @(subscriptions)s from "
?SQL("select @(jid)s, @(affiliation)s, @(subscriptions)s from "
" pubsub_state where nodeid=%(Nidx)d and jid in (%(GJ)s, %(SJ)s)"))
of
{selected, Res} ->
lists:foldr(
fun({true, A, S}, {_, Subs}) ->
fun({Jid, A, S}, {_, Subs}) when Jid == GJ ->
{decode_affiliation(A), Subs ++ decode_subscriptions(S)};
({_, _, S}, {Aff, Subs}) ->
{Aff, Subs ++ decode_subscriptions(S)}