Fix LIKE statements using double quotes instead of single ones (#1481)

This commit is contained in:
Ganael Laplanche 2024-09-03 12:28:24 +02:00 committed by GitHub
parent 5224cf7391
commit b0e2b4bb5d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 5 deletions

View File

@ -42,13 +42,13 @@ QMap<int, QString> DatabaseQueries::messageTableAttributes(bool only_msg_table,
if (is_sqlite) {
field_names[MSG_DB_LABELS] =
QSL("(SELECT GROUP_CONCAT(Labels.name) FROM Labels WHERE Messages.labels LIKE \"%.\" || "
"Labels.custom_id || \".%\") as msg_labels");
QSL("(SELECT GROUP_CONCAT(Labels.name) FROM Labels WHERE Messages.labels LIKE '%.' || "
"Labels.custom_id || '.%') as msg_labels");
}
else {
field_names[MSG_DB_LABELS] =
QSL("(SELECT GROUP_CONCAT(Labels.name) FROM Labels WHERE Messages.labels LIKE CONCAT(\"%.\", "
"Labels.custom_id, \".%\")) as msg_labels");
QSL("(SELECT GROUP_CONCAT(Labels.name) FROM Labels WHERE Messages.labels LIKE CONCAT('%.', "
"Labels.custom_id, '.%')) as msg_labels");
}
field_names[MSG_DB_LABELS_IDS] = QSL("Messages.labels");

View File

@ -918,7 +918,7 @@ bool ServiceRoot::loadMessagesForItem(RootItem* item, MessagesModel* model) {
else if (item->kind() == RootItem::Kind::Label) {
// Show messages with particular label.
model->setFilter(QSL("Messages.is_deleted = 0 AND Messages.is_pdeleted = 0 AND "
"Messages.labels LIKE \"%.%2.%\" AND Messages.account_id = %1")
"Messages.labels LIKE '%.%2.%' AND Messages.account_id = %1")
.arg(QString::number(accountId()), item->customId()));
}
else if (item->kind() == RootItem::Kind::Labels) {