fix mysql-related SQL
This commit is contained in:
parent
1d19f49a45
commit
6d06954825
@ -30,7 +30,7 @@ else {
|
|||||||
$maria_version = "10.6.12"
|
$maria_version = "10.6.12"
|
||||||
$maria_link = "https://archive.mariadb.org/mariadb-$maria_version/winx64-packages/mariadb-$maria_version-winx64.zip"
|
$maria_link = "https://archive.mariadb.org/mariadb-$maria_version/winx64-packages/mariadb-$maria_version-winx64.zip"
|
||||||
$maria_output = "maria.zip"
|
$maria_output = "maria.zip"
|
||||||
$cmake_version = "3.26.3"
|
$cmake_version = "3.26.4"
|
||||||
$cmake_link = "https://github.com/Kitware/CMake/releases/download/v$cmake_version/cmake-$cmake_version-windows-x86_64.zip"
|
$cmake_link = "https://github.com/Kitware/CMake/releases/download/v$cmake_version/cmake-$cmake_version-windows-x86_64.zip"
|
||||||
$cmake_output = "cmake.zip"
|
$cmake_output = "cmake.zip"
|
||||||
|
|
||||||
|
@ -110,10 +110,18 @@ bool DatabaseQueries::assignLabelToMessage(const QSqlDatabase& db, Label* label,
|
|||||||
QSqlQuery q(db);
|
QSqlQuery q(db);
|
||||||
|
|
||||||
q.setForwardOnly(true);
|
q.setForwardOnly(true);
|
||||||
// TODO: pro mysql, kde operátor concatenate || není
|
|
||||||
|
if (db.driverName() == QSL(APP_DB_MYSQL_DRIVER)) {
|
||||||
|
q.prepare(QSL("UPDATE Messages "
|
||||||
|
"SET labels = CONCAT(Messages.labels, :label) "
|
||||||
|
"WHERE Messages.custom_id = :message AND account_id = :account_id;"));
|
||||||
|
}
|
||||||
|
else {
|
||||||
q.prepare(QSL("UPDATE Messages "
|
q.prepare(QSL("UPDATE Messages "
|
||||||
"SET labels = Messages.labels || :label "
|
"SET labels = Messages.labels || :label "
|
||||||
"WHERE Messages.custom_id = :message AND account_id = :account_id;"));
|
"WHERE Messages.custom_id = :message AND account_id = :account_id;"));
|
||||||
|
}
|
||||||
|
|
||||||
q.bindValue(QSL(":label"), QSL("%1.").arg(label->customId()));
|
q.bindValue(QSL(":label"), QSL("%1.").arg(label->customId()));
|
||||||
q.bindValue(QSL(":message"), msg.m_customId.isEmpty() ? QString::number(msg.m_id) : msg.m_customId);
|
q.bindValue(QSL(":message"), msg.m_customId.isEmpty() ? QString::number(msg.m_id) : msg.m_customId);
|
||||||
q.bindValue(QSL(":account_id"), label->getParentServiceRoot()->accountId());
|
q.bindValue(QSL(":account_id"), label->getParentServiceRoot()->accountId());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user