Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
liblinphone
Commits
891df5ff
Commit
891df5ff
authored
Feb 01, 2018
by
Ronan
Browse files
fix(MainDb): add missing transactions on little req, add safety
parent
3b64a06c
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/db/main-db.cpp
View file @
891df5ff
...
...
@@ -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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment