mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-23 22:28:07 +00:00
fix(MainDb): add missing transactions on little req, add safety
This commit is contained in:
parent
3b64a06c3b
commit
891df5ff10
1 changed files with 6 additions and 2 deletions
|
|
@ -2012,6 +2012,7 @@ int MainDb::getChatMessageCount (const ChatRoomId &chatRoomId) const {
|
|||
" SELECT event_id FROM conference_event WHERE chat_room_id = :chatRoomId"
|
||||
")";
|
||||
|
||||
soci::transaction tr(*session);
|
||||
const long long &dbChatRoomId = d->selectChatRoomId(chatRoomId);
|
||||
*session << query, soci::use(dbChatRoomId), soci::into(count);
|
||||
}
|
||||
|
|
@ -2045,6 +2046,7 @@ int MainDb::getUnreadChatMessageCount (const ChatRoomId &chatRoomId) const {
|
|||
if (!chatRoomId.isValid())
|
||||
*session << query, soci::into(count);
|
||||
else {
|
||||
soci::transaction tr(*session);
|
||||
const long long &dbChatRoomId = d->selectChatRoomId(chatRoomId);
|
||||
*session << query, soci::use(dbChatRoomId), soci::into(count);
|
||||
}
|
||||
|
|
@ -2079,6 +2081,7 @@ void MainDb::markChatMessagesAsRead (const ChatRoomId &chatRoomId) const {
|
|||
if (!chatRoomId.isValid())
|
||||
*session << query;
|
||||
else {
|
||||
soci::transaction tr(*session);
|
||||
const long long &dbChatRoomId = d->selectChatRoomId(chatRoomId);
|
||||
*session << query, soci::use(dbChatRoomId);
|
||||
}
|
||||
|
|
@ -2280,10 +2283,11 @@ int MainDb::getHistorySize (const ChatRoomId &chatRoomId, FilterMask mask) const
|
|||
return L_SAFE_TRANSACTION {
|
||||
L_D();
|
||||
|
||||
soci::session *session = d->dbSession.getBackendSession();
|
||||
soci::transaction tr(*session);
|
||||
|
||||
int count;
|
||||
const long long &dbChatRoomId = d->selectChatRoomId(chatRoomId);
|
||||
|
||||
soci::session *session = d->dbSession.getBackendSession();
|
||||
*session << query, soci::into(count), soci::use(dbChatRoomId);
|
||||
|
||||
return count;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue