summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Ehrlicher <ch.ehrlicher@gmx.de>2019-12-07 20:34:12 +0100
committerChristian Ehrlicher <ch.ehrlicher@gmx.de>2019-12-09 06:32:39 +0100
commit10f39c908db2e3df933de8fbc553204e9bee65d7 (patch)
treeb5d8597e8a6640020a61e28af2463c77949f7784
parentc4b0ff4855e81aa8017664a2f1a4353b274c27fd (diff)
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>
-rw-r--r--src/plugins/sqldrivers/psql/qsql_psql.cpp1
1 files changed, 1 insertions, 0 deletions
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);