mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-27 07:59:20 +00:00
fix(MainDb): add a compatible trigger char message participant deleter with mysql
This commit is contained in:
parent
f2a25777d5
commit
1f8f765277
2 changed files with 9 additions and 10 deletions
|
|
@ -42,7 +42,7 @@ namespace Statements {
|
|||
// TODO: Improve, check backends.
|
||||
constexpr AbstractStatement (const Statement &a, const Statement &b) : mSql{ a.sql, b.sql } {}
|
||||
|
||||
const char *getSql (Backend backend) const {
|
||||
const char *get (Backend backend) const {
|
||||
return backend == Backend::Mysql && mSql[1] ? mSql[1] : mSql[0];
|
||||
}
|
||||
|
||||
|
|
@ -85,7 +85,7 @@ namespace Statements {
|
|||
// Select statements.
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
constexpr const char *select[SelectCount] = {
|
||||
constexpr AbstractStatement select[SelectCount] = {
|
||||
[SelectSipAddressId] = R"(
|
||||
SELECT id
|
||||
FROM sip_address
|
||||
|
|
@ -126,7 +126,7 @@ namespace Statements {
|
|||
// Select statements.
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
constexpr const char *insert[InsertCount] = {
|
||||
constexpr AbstractStatement insert[InsertCount] = {
|
||||
[InsertOneToOneChatRoom] = R"(
|
||||
INSERT INTO one_to_one_chat_room (
|
||||
chat_room_id, participant_a_sip_address_id, participant_b_sip_address_id
|
||||
|
|
@ -139,18 +139,15 @@ namespace Statements {
|
|||
// ---------------------------------------------------------------------------
|
||||
|
||||
const char *get (Create createStmt, AbstractDb::Backend backend) {
|
||||
(void)backend;
|
||||
return createStmt >= Create::CreateCount ? nullptr : create[createStmt].getSql(backend);
|
||||
return createStmt >= Create::CreateCount ? nullptr : create[createStmt].get(backend);
|
||||
}
|
||||
|
||||
const char *get (Select selectStmt, AbstractDb::Backend backend) {
|
||||
(void)backend;
|
||||
return selectStmt >= Select::SelectCount ? nullptr : select[selectStmt];
|
||||
return selectStmt >= Select::SelectCount ? nullptr : select[selectStmt].get(backend);
|
||||
}
|
||||
|
||||
const char *get (Insert insertStmt, AbstractDb::Backend backend) {
|
||||
(void)backend;
|
||||
return insertStmt >= Insert::InsertCount ? nullptr : insert[insertStmt];
|
||||
return insertStmt >= Insert::InsertCount ? nullptr : insert[insertStmt].get(backend);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1697,7 +1697,9 @@ void MainDb::init () {
|
|||
|
||||
if (getBackend() == Backend::Mysql)
|
||||
*session <<
|
||||
"CREATE TRIGGER IF NOT EXISTS chat_message_participant_deleter"
|
||||
"DROP TRIGGER IF EXISTS chat_message_participant_deleter";
|
||||
*session <<
|
||||
"CREATE TRIGGER chat_message_participant_deleter"
|
||||
" AFTER UPDATE ON conference_chat_message_event FOR EACH ROW"
|
||||
" BEGIN"
|
||||
" IF NEW.state = " + Utils::toString(int(ChatMessage::State::Displayed)) + " THEN"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue