diff --git a/mythtv/libs/libmythbase/mythdbcon.cpp b/mythtv/libs/libmythbase/mythdbcon.cpp index 33bf128c860..71cb9ed8e7d 100644 --- a/mythtv/libs/libmythbase/mythdbcon.cpp +++ b/mythtv/libs/libmythbase/mythdbcon.cpp @@ -881,6 +881,15 @@ bool MSqlQuery::testDBConnection() void MSqlQuery::bindValue(const QString &placeholder, const QVariant &val) { +#if QT_VERSION < QT_VERSION_CHECK(6,0,0) + if (static_cast(val.type()) == QMetaType::QDateTime) + { + QSqlQuery::bindValue(placeholder, + MythDate::toString(val.toDateTime(), MythDate::kDatabase), + QSql::In); + return; + } +#endif QSqlQuery::bindValue(placeholder, val, QSql::In); } @@ -896,6 +905,15 @@ void MSqlQuery::bindValueNoNull(const QString &placeholder, const QVariant &val) QSqlQuery::bindValue(placeholder, QString(""), QSql::In); return; } +#if QT_VERSION < QT_VERSION_CHECK(6,0,0) + if (type == QMetaType::QDateTime) + { + QSqlQuery::bindValue(placeholder, + MythDate::toString(val.toDateTime(), MythDate::kDatabase), + QSql::In); + return; + } +#endif QSqlQuery::bindValue(placeholder, val, QSql::In); }