summaryrefslogtreecommitdiffstats
path: root/src/plugins/sqldrivers/psql
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2020-06-15 09:31:31 +0200
committerLars Knoll <lars.knoll@qt.io>2020-08-15 10:56:33 +0200
commit67f04fa060be1b75b8ea60ac6eb45d1577d1fdaf (patch)
tree368d745ae016534cb2e18c7f5454fffbc8c1216f /src/plugins/sqldrivers/psql
parent8929c0a3550ae27cb5c9ed276d4c5a85594ba682 (diff)
Deprecate QVariant::Type uses in QSqlField
Add metaType()/setMetaType() methods to be used instead of the type() methods taking a QVariant::Type. Change-Id: Ieaba35b73f8061cd83288dd6b50d58322db3c7ed Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Diffstat (limited to 'src/plugins/sqldrivers/psql')
-rw-r--r--src/plugins/sqldrivers/psql/qsql_psql.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/plugins/sqldrivers/psql/qsql_psql.cpp b/src/plugins/sqldrivers/psql/qsql_psql.cpp
index b477f701e2..60729840e2 100644
--- a/src/plugins/sqldrivers/psql/qsql_psql.cpp
+++ b/src/plugins/sqldrivers/psql/qsql_psql.cpp
@@ -634,7 +634,7 @@ QVariant QPSQLResult::data(int i)
int ptype = PQftype(d->result, i);
QVariant::Type type = qDecodePSQLType(ptype);
if (PQgetisnull(d->result, currentRow, i))
- return QVariant(type);
+ return QVariant(QMetaType(type), nullptr);
const char *val = PQgetvalue(d->result, currentRow, i);
switch (type) {
case QVariant::Bool:
@@ -805,8 +805,8 @@ QSqlRecord QPSQLResult::record() const
f.setTableName(QString());
}
int ptype = PQftype(d->result, i);
- f.setType(qDecodePSQLType(ptype));
- f.setValue(QVariant(f.type())); // only set in setType() when it's invalid before
+ f.setMetaType(QMetaType(qDecodePSQLType(ptype)));
+ f.setValue(QVariant(f.metaType())); // only set in setType() when it's invalid before
int len = PQfsize(d->result, i);
int precision = PQfmod(d->result, i);
@@ -856,7 +856,7 @@ static QString qCreateParamString(const QList<QVariant> &boundValues, const QSql
QString params;
QSqlField f;
for (const QVariant &val : boundValues) {
- f.setType(val.type());
+ f.setMetaType(val.metaType());
if (val.isNull())
f.clear();
else
@@ -1476,7 +1476,7 @@ QString QPSQLDriver::formatValue(const QSqlField &field, bool trimStrings) const
if (field.isNull()) {
r = nullStr();
} else {
- switch (int(field.type())) {
+ switch (field.metaType().id()) {
case QVariant::DateTime:
#if QT_CONFIG(datestring)
if (field.value().toDateTime().isValid()) {