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 <robertsz27@interia.pl>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
bb10
Christian Ehrlicher 2019-12-07 20:34:12 +01:00
parent c4b0ff4855
commit 10f39c908d
1 changed files with 1 additions and 0 deletions

View File

@ -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);