dcd87049bb
In Qt 5, QVariant::isNull() was true when the contained object had an isNull() that was true; this is no longer true in Qt 6, so we now have QSqlResultPrivate::isVariantNull() to test is-or-contains null. However, for date-times, QSqlDriver::formatValue() treats invalid QDateTime as NULL, since it needs its toString(Qt::ISODate), which will be empty if invalid. As QDateTime's isValid() is more stringent than its !isNull(), this can lead to one that's neither valid nor null, such as QDateTime(QDate(), QTime(0, 0)), producing an invalid entry in a database. Do the same for QTime, as its isValid() is more stringent than !isNull(), and its toString() likewise returns empty on invalid (although it's not clear it's possible to construct one that's neither valid nor null). For QDate valid and null are simply complementary. [ChangeLog][QSql] Handling of QDateTime and QTime values passed to SQL now consistently treats invalid as null. Some values of these types are neither valid nor null, which could lead to invalid data being given to the SQL database. Invalid values are now treated as null to prevent this. Task-number: QTBUG-98471 Pick-to: 6.3 Change-Id: I145411280d6bcc53dc0dc5f4a1cb938d995fd6bc Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> |
||
---|---|---|
.github/workflows | ||
bin | ||
cmake | ||
coin | ||
config.tests | ||
dist | ||
doc | ||
examples | ||
lib | ||
libexec | ||
mkspecs | ||
qmake | ||
src | ||
tests | ||
util | ||
.cmake.conf | ||
.gitattributes | ||
.gitignore | ||
.lgtm.yml | ||
.tag | ||
CMakeLists.txt | ||
conanfile.py | ||
config_help.txt | ||
configure | ||
configure.bat | ||
configure.cmake | ||
dependencies.yaml | ||
LICENSE.FDL | ||
LICENSE.GPL2 | ||
LICENSE.GPL3 | ||
LICENSE.GPL3-EXCEPT | ||
LICENSE.LGPL3 | ||
LICENSE.QT-LICENSE-AGREEMENT | ||
qt_cmdline.cmake | ||
sync.profile |