Fix - psql driver must format qdatetime using iso

QDateTime must be formatted as ISO8601 specifies, date/month must pe padded with 0 until width is 2
Task-number:QTBUG-33389

Change-Id: If07bcaa976ea3583369da3fd21ce442ee30e8c1f
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
This commit is contained in:
Cristian Tarsoaga 2013-10-13 23:33:15 +03:00 committed by The Qt Project
parent 076f931de5
commit 1d03918454

View File

@ -1253,8 +1253,8 @@ QString QPSQLDriver::formatValue(const QSqlField &field, bool trimStrings) const
QTime tm = field.value().toDateTime().time();
// msecs need to be right aligned otherwise psql interprets them wrong
r = QLatin1Char('\'') + QString::number(dt.year()) + QLatin1Char('-')
+ QString::number(dt.month()) + QLatin1Char('-')
+ QString::number(dt.day()) + QLatin1Char(' ')
+ QString::number(dt.month()).rightJustified(2, QLatin1Char('0')) + QLatin1Char('-')
+ QString::number(dt.day()).rightJustified(2, QLatin1Char('0')) + QLatin1Char(' ')
+ tm.toString() + QLatin1Char('.')
+ QString::number(tm.msec()).rightJustified(3, QLatin1Char('0'))
+ QLatin1Char('\'');