summaryrefslogtreecommitdiffstats
path: root/src/plugins/sqldrivers/db2/qsql_db2.cpp
diff options
context:
space:
mode:
authorVolker Hilsheimer <[email protected]>2021-12-22 15:09:23 +0100
committerVolker Hilsheimer <[email protected]>2022-01-12 17:41:07 +0100
commit999d856bc8569455c21850dc524a595e6b6f52b6 (patch)
tree8ed959c57f0fcbf527324204df1b00e0b76d6074 /src/plugins/sqldrivers/db2/qsql_db2.cpp
parent66f0149693c810a512001d9d4df89b6f9d7a9327 (diff)
Adapt SQL drivers to Qt 6 change of QVariant::isNull
In Qt 5, QVariant::isNull returned true if either the variant didn't contain a value, or if the value was of a nullable type where the type's isNull member function returned true. In Qt 6, QVariant::isNull only returns true for variants that don't contain a value; if the value contained is e.g. a null-QString or QDateTime, then QVariant::isNull returns false. This change requires a follow up in the SQL drivers, which must still treat null-values the same as null-variants, lest they write data into the data base. Add a static helper to QSqlResultPrivate that implements isNull-checking of variants that contain a nullable type relevant for Sql, and add a test case to the QSqlQuery test that exercises that code. Pick-to: 6.2 6.3 Fixes: QTBUG-99408 Fixes: QTBUG-98471 Change-Id: I08b74a33aa3235c37d974f182da1f2bdcfd8217e Reviewed-by: Fabian Kosmale <[email protected]>
Diffstat (limited to 'src/plugins/sqldrivers/db2/qsql_db2.cpp')
-rw-r--r--src/plugins/sqldrivers/db2/qsql_db2.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/plugins/sqldrivers/db2/qsql_db2.cpp b/src/plugins/sqldrivers/db2/qsql_db2.cpp
index e605ac91a20..00bcc1cc4aa 100644
--- a/src/plugins/sqldrivers/db2/qsql_db2.cpp
+++ b/src/plugins/sqldrivers/db2/qsql_db2.cpp
@@ -697,7 +697,7 @@ bool QDB2Result::exec()
for (i = 0; i < values.count(); ++i) {
// bind parameters - only positional binding allowed
SQLLEN *ind = &indicators[i];
- if (values.at(i).isNull())
+ if (QSqlResultPrivate::isVariantNull(values.at(i)))
*ind = SQL_NULL_DATA;
if (bindValueType(i) & QSql::Out)
values[i].detach();