Commit c4670b98 authored by Ronan's avatar Ronan Committed by Matthieu Tanon

fix(MainDb): select one to one chat room id returns at most one result

parent 887b41c9
Pipeline #676 canceled with stage
in 0 seconds
......@@ -77,7 +77,11 @@ namespace Statements {
SELECT chat_room_id
FROM one_to_one_chat_room
WHERE participant_a_sip_address_id IN (:1, :2)
AND participant_b_sip_address_id IN (:3, :4)
AND participant_b_sip_address_id IN (:1, :2)
AND (
(participant_a_sip_address_id <> participant_b_sip_address_id AND :1 <> :2) OR
(participant_a_sip_address_id = participant_b_sip_address_id AND :1 = :2)
)
)",
/* SelectConferenceEvent */ R"(
......
......@@ -478,7 +478,7 @@ long long MainDbPrivate::selectOneToOneChatRoomId (long long sipAddressIdA, long
soci::session *session = dbSession.getBackendSession();
*session << Statements::get(Statements::SelectOneToOneChatRoomId),
soci::use(sipAddressIdA), soci::use(sipAddressIdB), soci::use(sipAddressIdA), soci::use(sipAddressIdB),
soci::use(sipAddressIdA, "1"), soci::use(sipAddressIdB, "2"),
soci::into(chatRoomId);
return session->got_data() ? chatRoomId : -1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment