Use QStringView overloads of <QDate/Time>::toString()
There are no QLatin1String overloads, so using QLatin1String as the format string produced a temporary QString. Use QStringViewLiteral instead. Change-Id: I682eb8cfaa98fdcfb491edd290460db636a98a9f Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
parent
dd8131e3b2
commit
2f542dd996
@ -1344,7 +1344,7 @@ QDateTime QNetworkHeadersPrivate::fromHttpDate(const QByteArray &value)
|
|||||||
|
|
||||||
QByteArray QNetworkHeadersPrivate::toHttpDate(const QDateTime &dt)
|
QByteArray QNetworkHeadersPrivate::toHttpDate(const QDateTime &dt)
|
||||||
{
|
{
|
||||||
return QLocale::c().toString(dt, QLatin1String("ddd, dd MMM yyyy hh:mm:ss 'GMT'"))
|
return QLocale::c().toString(dt, QStringViewLiteral("ddd, dd MMM yyyy hh:mm:ss 'GMT'"))
|
||||||
.toLatin1();
|
.toLatin1();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1506,7 +1506,7 @@ QString QPSQLDriver::formatValue(const QSqlField &field, bool trimStrings) const
|
|||||||
// this is safe since postgresql stores only the UTC value and not the timezone offset (only used
|
// this is safe since postgresql stores only the UTC value and not the timezone offset (only used
|
||||||
// while parsing), so we have correct behavior in both case of with timezone and without tz
|
// while parsing), so we have correct behavior in both case of with timezone and without tz
|
||||||
r = QStringLiteral("TIMESTAMP WITH TIME ZONE ") + QLatin1Char('\'') +
|
r = QStringLiteral("TIMESTAMP WITH TIME ZONE ") + QLatin1Char('\'') +
|
||||||
QLocale::c().toString(field.value().toDateTime().toUTC(), QStringLiteral("yyyy-MM-ddThh:mm:ss.zzz")) +
|
QLocale::c().toString(field.value().toDateTime().toUTC(), QStringViewLiteral("yyyy-MM-ddThh:mm:ss.zzz")) +
|
||||||
QLatin1Char('Z') + QLatin1Char('\'');
|
QLatin1Char('Z') + QLatin1Char('\'');
|
||||||
} else {
|
} else {
|
||||||
r = nullStr();
|
r = nullStr();
|
||||||
@ -1518,7 +1518,7 @@ QString QPSQLDriver::formatValue(const QSqlField &field, bool trimStrings) const
|
|||||||
case QVariant::Time:
|
case QVariant::Time:
|
||||||
#if QT_CONFIG(datestring)
|
#if QT_CONFIG(datestring)
|
||||||
if (field.value().toTime().isValid()) {
|
if (field.value().toTime().isValid()) {
|
||||||
r = QLatin1Char('\'') + field.value().toTime().toString(QLatin1String("hh:mm:ss.zzz")) + QLatin1Char('\'');
|
r = QLatin1Char('\'') + field.value().toTime().toString(QStringViewLiteral("hh:mm:ss.zzz")) + QLatin1Char('\'');
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
@ -813,7 +813,7 @@ QString QTDSDriver::formatValue(const QSqlField &field,
|
|||||||
r = QLatin1String("NULL");
|
r = QLatin1String("NULL");
|
||||||
else if (field.type() == QVariant::DateTime) {
|
else if (field.type() == QVariant::DateTime) {
|
||||||
if (field.value().toDateTime().isValid()){
|
if (field.value().toDateTime().isValid()){
|
||||||
r = field.value().toDateTime().toString(QLatin1String("yyyyMMdd hh:mm:ss"));
|
r = field.value().toDateTime().toString(QStringViewLiteral("yyyyMMdd hh:mm:ss"));
|
||||||
r.prepend(QLatin1String("'"));
|
r.prepend(QLatin1String("'"));
|
||||||
r.append(QLatin1String("'"));
|
r.append(QLatin1String("'"));
|
||||||
} else
|
} else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user