PostgreSQL: fix datetime format when system locale doesn't use arabic numerals
psql driver was previously using QDateTime::toString() function which is locale-depndent. Task-number: QTBUG-59524 Change-Id: I7f50f95b5c82e66476abfee24ad28b78b3257041 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>bb10
parent
5c724a6087
commit
ac74abdf50
|
|
@ -50,6 +50,7 @@
|
|||
#include <qsqlquery.h>
|
||||
#include <qsocketnotifier.h>
|
||||
#include <qstringlist.h>
|
||||
#include <qlocale.h>
|
||||
#include <QtSql/private/qsqlresult_p.h>
|
||||
#include <QtSql/private/qsqldriver_p.h>
|
||||
|
||||
|
|
@ -1307,7 +1308,9 @@ QString QPSQLDriver::formatValue(const QSqlField &field, bool trimStrings) const
|
|||
// we force the value to be considered with a timezone information, and we force it to be UTC
|
||||
// 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
|
||||
r = QLatin1String("TIMESTAMP WITH TIME ZONE ") + QLatin1Char('\'') + field.value().toDateTime().toUTC().toString(QLatin1String("yyyy-MM-ddThh:mm:ss.zzz")) + QLatin1Char('Z') + QLatin1Char('\'');
|
||||
r = QLatin1String("TIMESTAMP WITH TIME ZONE ") + QLatin1Char('\'') +
|
||||
QLocale::c().toString(field.value().toDateTime().toUTC(), QLatin1String("yyyy-MM-ddThh:mm:ss.zzz")) +
|
||||
QLatin1Char('Z') + QLatin1Char('\'');
|
||||
} else {
|
||||
r = QLatin1String("NULL");
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue