From 434494dfb75ea0248bd9e64dc3426793b442db9f Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Mon, 20 May 2024 18:06:39 +0200 Subject: [PATCH] SQL/IBase: don't let open() fail when no timezones are available When connecting to an old Firebird instence with a Qt Firebird plugin linked against Firebird >= 4 the timezone table is not available and therefore open() will fail. Therefore downgrade the non-existence of this table to a qCInfo(). Fixes: QTBUG-125467 Change-Id: Iae6d110bc2a48b5b90ffb9cb38f3fba60f30770f Reviewed-by: Axel Spoerl Reviewed-by: Andreas Bacher --- src/plugins/sqldrivers/ibase/qsql_ibase.cpp | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/src/plugins/sqldrivers/ibase/qsql_ibase.cpp b/src/plugins/sqldrivers/ibase/qsql_ibase.cpp index f6eed5e227..9bfaeb2e92 100644 --- a/src/plugins/sqldrivers/ibase/qsql_ibase.cpp +++ b/src/plugins/sqldrivers/ibase/qsql_ibase.cpp @@ -347,21 +347,14 @@ public: QSqlQuery qry(q->createResult()); qry.setForwardOnly(true); qry.exec(QString("select * from RDB$TIME_ZONES"_L1)); - if (qry.lastError().type()) { - q->setLastError(QSqlError( - QCoreApplication::translate("QIBaseDriver", - "failed to query time zone mapping from system table"), - qry.lastError().databaseText(), - QSqlError::StatementError, - qry.lastError().nativeErrorCode())); - + if (qry.lastError().isValid()) { + qCInfo(lcIbase) << "Table 'RDB$TIME_ZONES' not found - not timezone support available"; return; } while (qry.next()) { - auto record = qry.record(); - quint16 fbTzId = record.value(0).value(); - QByteArray ianaId = record.value(1).toByteArray().simplified(); + quint16 fbTzId = qry.value(0).value(); + QByteArray ianaId = qry.value(1).toByteArray().simplified(); qFbTzIdToIanaIdMap()->insert(fbTzId, ianaId); qIanaIdToFbTzIdMap()->insert(ianaId, fbTzId); }