From ae42461f44cf63a66a087cf8c2660c3d914f474c Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Tue, 22 May 2018 15:22:23 +0200 Subject: MySQL: Handle TIME types as a string to allow the full range of data As the full range of TIME is '-838:59:59' to '838:59:59' then we cannot use QTime as the object to store this data in. Therefore a QString is used instead for passing the data to and from. This does not impact existing code using QTime already as it will still convert it from the QString to a QTime to give the same result as before. [ChangeLog][QtSql][MySQL] The TIME data type is now treated like a string-based type in order to respect the full range of the TIME data type. Task-number: QTBUG-57028 Change-Id: Ieb7105bff3043b845f76bc873d088e6bac1e4f10 Reviewed-by: Edward Welbourne --- src/plugins/sqldrivers/mysql/qsql_mysql.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/plugins/sqldrivers/mysql') diff --git a/src/plugins/sqldrivers/mysql/qsql_mysql.cpp b/src/plugins/sqldrivers/mysql/qsql_mysql.cpp index 18c8b48462..9c6c3ff429 100644 --- a/src/plugins/sqldrivers/mysql/qsql_mysql.cpp +++ b/src/plugins/sqldrivers/mysql/qsql_mysql.cpp @@ -305,7 +305,9 @@ static QVariant::Type qDecodeMYSQLType(int mysqltype, uint flags) type = QVariant::Date; break; case FIELD_TYPE_TIME : - type = QVariant::Time; + // A time field can be within the range '-838:59:59' to '838:59:59' so + // use QString instead of QTime since QTime is limited to 24 hour clock + type = QVariant::String; break; case FIELD_TYPE_DATETIME : case FIELD_TYPE_TIMESTAMP : -- cgit v1.2.3