SQL/OCI: use QDateTime::toString("ttt")

Use QDateTime::toString("ttt") which is available since Qt6.5 instead
own implementation

Pick-to: 6.5
Fixes: QTBUG-111275
Change-Id: I41676d3a327c5aaabdeb4f54b9d169e228c482e1
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
This commit is contained in:
Christian Ehrlicher 2023-02-21 18:39:08 +01:00
parent 277f3345f2
commit 79b22bb1f3

View File

@ -131,15 +131,6 @@ public:
~QOCIDateTime();
OCIDateTime *dateTime;
static QDateTime fromOCIDateTime(OCIEnv *env, OCIError *err, OCIDateTime *dt);
static QString toOffsetString(const QDateTime &dt)
{
const auto offset = dt.offsetFromUtc();
const auto offsetAbs = qAbs(offset) / 60;
return QString::asprintf("%c%02d:%02d",
offset >= 0 ? '+' : '-',
offsetAbs / 60,
offsetAbs % 60);
}
};
QOCIDateTime::QOCIDateTime(OCIEnv *env, OCIError *err, const QDateTime &dt)
@ -150,7 +141,7 @@ QOCIDateTime::QOCIDateTime(OCIEnv *env, OCIError *err, const QDateTime &dt)
const QDate date = dt.date();
const QTime time = dt.time();
// Zone in +hh:mm format
const QString timeZone = toOffsetString(dt);
const QString timeZone = dt.toString("ttt");
const OraText *tz = reinterpret_cast<const OraText *>(timeZone.utf16());
OCIDateTimeConstruct(env, err, dateTime, date.year(), date.month(), date.day(), time.hour(),
time.minute(), time.second(), time.msec() * 1000000,