From 10f39c908db2e3df933de8fbc553204e9bee65d7 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Sat, 7 Dec 2019 20:34:12 +0100 Subject: PSQL: set correct empty QVariant in QPSQLResult::record() Since the QSqlField used to retrieve the data is reused in the loop, the default empty value of the QSqlField is not set for all except the first field since it was implicitly set by QSqlField::setType() only when the value is invalid. Therefore we have to call QSqlField::setValue() directly. Change-Id: I1d3abe4e3c46f6378f9ff25529a79bbe33bb7b74 Reviewed-by: Robert Szefner Reviewed-by: Andy Shaw --- src/plugins/sqldrivers/psql/qsql_psql.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/plugins/sqldrivers/psql') diff --git a/src/plugins/sqldrivers/psql/qsql_psql.cpp b/src/plugins/sqldrivers/psql/qsql_psql.cpp index 760685f64b..78ede6a0d3 100644 --- a/src/plugins/sqldrivers/psql/qsql_psql.cpp +++ b/src/plugins/sqldrivers/psql/qsql_psql.cpp @@ -838,6 +838,7 @@ QSqlRecord QPSQLResult::record() const } int ptype = PQftype(d->result, i); f.setType(qDecodePSQLType(ptype)); + f.setValue(QVariant(f.type())); // only set in setType() when it's invalid before int len = PQfsize(d->result, i); int precision = PQfmod(d->result, i); -- cgit v1.2.3