Commit cfc1a5a2 authored by Volker Krause's avatar Volker Krause
Browse files

Fix SQL query generation with Qt6

Strings are now also sequentially iterable in a QVariant, so we
ended up generating query bindings for each character in string values
in SQL conditions here.

This makes a bunch of unit tests pass and actually allows Akonadi to
start up without tons of database errors now.
parent aef5ba8c
Pipeline #197054 passed with stage
in 10 minutes and 35 seconds
......@@ -530,7 +530,8 @@ void QueryBuilder::buildWhereCondition(QString *query, const Query::Condition &c
*query += compareOperatorToString(cond.mCompareOp);
if (cond.mComparedColumn.isEmpty()) {
if (cond.mComparedValue.isValid()) {
if (cond.mComparedValue.canConvert(QVariant::List)) {
if (cond.mComparedValue.canConvert(QVariant::List) && cond.mComparedValue.type() != QVariant::String
&& cond.mComparedValue.type() != QVariant::ByteArray) {
*query += QLatin1String("( ");
const QVariantList &entries = cond.mComparedValue.toList();
Q_ASSERT_X(!entries.isEmpty(), "QueryBuilder::buildWhereCondition()", "No values given for IN condition.");
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment