diff options
author | Bill King <bking@trolltech.com.au> | 2009-03-31 03:16:54 (GMT) |
---|---|---|
committer | Bill King <bill.king@nokia.com> | 2009-03-31 03:36:04 (GMT) |
commit | 8c21eabd758e7350b6736d968d4a30b03e75b2c3 (patch) | |
tree | c2dd565dd87a79955b19fd47df14f9e9969ab6d9 /src/sql | |
parent | 1f695f65df9d78dc10c0277a9914c65902168c1c (diff) | |
download | Qt-8c21eabd758e7350b6736d968d4a30b03e75b2c3.zip Qt-8c21eabd758e7350b6736d968d4a30b03e75b2c3.tar.gz Qt-8c21eabd758e7350b6736d968d4a30b03e75b2c3.tar.bz2 |
Fixes: QPSQL: datetime or time fields with negative time zone
offsets not handled correctly
Now also removes negative timestamps.
Task-number: 249059
Reviewed-by: Justin McPherson
Diffstat (limited to 'src/sql')
-rw-r--r-- | src/sql/drivers/psql/qsql_psql.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/sql/drivers/psql/qsql_psql.cpp b/src/sql/drivers/psql/qsql_psql.cpp index e33dd95..afe45fc 100644 --- a/src/sql/drivers/psql/qsql_psql.cpp +++ b/src/sql/drivers/psql/qsql_psql.cpp @@ -351,8 +351,9 @@ QVariant QPSQLResult::data(int i) #ifndef QT_NO_DATESTRING if (str.isEmpty()) return QVariant(QTime()); - if (str.at(str.length() - 3) == QLatin1Char('+')) + if (str.at(str.length() - 3) == QLatin1Char('+') || str.at(str.length() - 3) == QLatin1Char('-')) // strip the timezone + // TODO: fix this when timestamp support comes into QDateTime return QVariant(QTime::fromString(str.left(str.length() - 3), Qt::ISODate)); return QVariant(QTime::fromString(str, Qt::ISODate)); #else @@ -365,7 +366,8 @@ QVariant QPSQLResult::data(int i) if (dtval.length() < 10) return QVariant(QDateTime()); // remove the timezone - if (dtval.at(dtval.length() - 3) == QLatin1Char('+')) + // TODO: fix this when timestamp support comes into QDateTime + if (dtval.at(dtval.length() - 3) == QLatin1Char('+') || dtval.at(dtval.length() - 3) == QLatin1Char('-')) dtval.chop(3); // milliseconds are sometimes returned with 2 digits only if (dtval.at(dtval.length() - 3).isPunct()) |