Make SQL query more generic for MSSQL compatibility (#3271)
This commit is contained in:
parent
4580feaa3c
commit
44528d3fef
|
@ -897,12 +897,12 @@ select_affiliation_subscriptions(Nidx, GenKey, SubKey) ->
|
||||||
GJ = encode_jid(GenKey),
|
GJ = encode_jid(GenKey),
|
||||||
SJ = encode_jid(SubKey),
|
SJ = encode_jid(SubKey),
|
||||||
case catch ejabberd_sql:sql_query_t(
|
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)"))
|
" pubsub_state where nodeid=%(Nidx)d and jid in (%(GJ)s, %(SJ)s)"))
|
||||||
of
|
of
|
||||||
{selected, Res} ->
|
{selected, Res} ->
|
||||||
lists:foldr(
|
lists:foldr(
|
||||||
fun({true, A, S}, {_, Subs}) ->
|
fun({Jid, A, S}, {_, Subs}) when Jid == GJ ->
|
||||||
{decode_affiliation(A), Subs ++ decode_subscriptions(S)};
|
{decode_affiliation(A), Subs ++ decode_subscriptions(S)};
|
||||||
({_, _, S}, {Aff, Subs}) ->
|
({_, _, S}, {Aff, Subs}) ->
|
||||||
{Aff, Subs ++ decode_subscriptions(S)}
|
{Aff, Subs ++ decode_subscriptions(S)}
|
||||||
|
|
Loading…
Reference in New Issue