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 <axel.spoerl@qt.io>
Reviewed-by: Andreas Bacher <andi.bacher@outlook.com>
This commit is contained in:
Christian Ehrlicher 2024-05-20 18:06:39 +02:00
parent 462c958a92
commit 434494dfb7

View File

@ -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<quint16>();
QByteArray ianaId = record.value(1).toByteArray().simplified();
quint16 fbTzId = qry.value(0).value<quint16>();
QByteArray ianaId = qry.value(1).toByteArray().simplified();
qFbTzIdToIanaIdMap()->insert(fbTzId, ianaId);
qIanaIdToFbTzIdMap()->insert(ianaId, fbTzId);
}