SQL/QSqlField: deprecate internal functions setSqlType()/typeID()
These functions set/get the db-specific internal sql type but it's not used in any of the sql plugins since ages. Any external plugin using this for some reason must be ported away until Qt7. Change-Id: Ifb33e9d3be0b80fb4d0979d31436e89ea6a8208b Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
parent
e2e818483f
commit
e65dc19332
@ -186,9 +186,7 @@ void Browser::showMetaData(const QString &t)
|
||||
for (int i = 0; i < rec.count(); ++i) {
|
||||
QSqlField fld = rec.field(i);
|
||||
model->setData(model->index(i, 0), fld.name());
|
||||
model->setData(model->index(i, 1), fld.typeID() == -1
|
||||
? QString(fld.metaType().name())
|
||||
: QString("%1 (%2)").arg(fld.metaType().name()).arg(fld.typeID()));
|
||||
model->setData(model->index(i, 1), QString::fromUtf8(fld.metaType().name()));
|
||||
model->setData(model->index(i, 2), fld.length());
|
||||
model->setData(model->index(i, 3), fld.precision());
|
||||
model->setData(model->index(i, 4), fld.requiredStatus() == -1 ? QVariant("?")
|
||||
|
@ -305,7 +305,6 @@ static QSqlField qMakeFieldInfo(const QDB2ResultPrivate* d, int i)
|
||||
// else required is unknown
|
||||
f.setLength(colSize == 0 ? -1 : int(colSize));
|
||||
f.setPrecision(colScale == 0 ? -1 : int(colScale));
|
||||
f.setSqlType(int(colType));
|
||||
SQLTCHAR tableName[TABLENAMESIZE];
|
||||
SQLSMALLINT tableNameLen;
|
||||
r = SQLColAttribute(d->hStmt, i + 1, SQL_DESC_BASE_TABLE_NAME, tableName,
|
||||
@ -505,7 +504,6 @@ static QSqlField qMakeFieldInfo(const SQLHANDLE hStmt)
|
||||
// else we don't know.
|
||||
f.setLength(qGetIntData(hStmt, 6, isNull)); // column size
|
||||
f.setPrecision(qGetIntData(hStmt, 8, isNull)); // precision
|
||||
f.setSqlType(type);
|
||||
return f;
|
||||
}
|
||||
|
||||
|
@ -1458,7 +1458,6 @@ QSqlRecord QIBaseResult::record() const
|
||||
f.setRequiredStatus(q.value(3).toBool() ? QSqlField::Required : QSqlField::Optional);
|
||||
}
|
||||
}
|
||||
f.setSqlType(v.sqltype);
|
||||
rec.append(f);
|
||||
}
|
||||
return rec;
|
||||
@ -1728,7 +1727,6 @@ QSqlRecord QIBaseDriver::record(const QString& tablename) const
|
||||
f.setPrecision(0);
|
||||
}
|
||||
f.setRequired(q.value(5).toInt() > 0);
|
||||
f.setSqlType(type);
|
||||
|
||||
rec.append(f);
|
||||
}
|
||||
|
@ -916,7 +916,6 @@ QSqlRecord QMimerSQLResult::record() const
|
||||
field.setName(QString::fromWCharArray(colName_w));
|
||||
const int32_t mType = MimerColumnType(d->statementhandle, static_cast<std::int16_t>(i) + 1);
|
||||
const QMetaType::Type type = qDecodeMSQLType(mType);
|
||||
field.setSqlType(mType);
|
||||
field.setMetaType(QMetaType(type));
|
||||
field.setValue(QVariant(field.metaType()));
|
||||
// field.setPrecision(); Should be implemented once the Mimer API can give this
|
||||
|
@ -266,7 +266,6 @@ static QSqlField qToField(MYSQL_FIELD *field)
|
||||
f.setRequired(IS_NOT_NULL(field->flags));
|
||||
f.setLength(field->length);
|
||||
f.setPrecision(field->decimals);
|
||||
f.setSqlType(field->type);
|
||||
f.setAutoValue(field->flags & AUTO_INCREMENT_FLAG);
|
||||
return f;
|
||||
}
|
||||
|
@ -738,7 +738,6 @@ static QSqlField qFromOraInf(const OraFieldInfo &ofi)
|
||||
f.setLength(ofi.oraPrecision == 0 ? 38 : int(ofi.oraPrecision));
|
||||
|
||||
f.setPrecision(ofi.oraScale);
|
||||
f.setSqlType(int(ofi.oraType));
|
||||
return f;
|
||||
}
|
||||
|
||||
|
@ -609,7 +609,6 @@ static QSqlField qMakeFieldInfo(const SQLHANDLE hStmt, const QODBCDriverPrivate*
|
||||
f.setLength(var.isNull() ? -1 : var.toInt()); // column size
|
||||
var = qGetIntData(hStmt, 8).toInt();
|
||||
f.setPrecision(var.isNull() ? -1 : var.toInt()); // precision
|
||||
f.setSqlType(type);
|
||||
int required = qGetIntData(hStmt, 10).toInt(); // nullable-flag
|
||||
// required can be SQL_NO_NULLS, SQL_NULLABLE or SQL_NULLABLE_UNKNOWN
|
||||
if (required == SQL_NO_NULLS)
|
||||
@ -661,7 +660,6 @@ static QSqlField qMakeFieldInfo(const QODBCResultPrivate *p, int i)
|
||||
// nullable can be SQL_NO_NULLS, SQL_NULLABLE or SQL_NULLABLE_UNKNOWN
|
||||
QMetaType type = qDecodeODBCType(colType, unsignedFlag == SQL_FALSE);
|
||||
QSqlField f(qColName, type);
|
||||
f.setSqlType(colType);
|
||||
f.setLength(colSize == 0 ? -1 : int(colSize));
|
||||
f.setPrecision(colScale == 0 ? -1 : int(colScale));
|
||||
if (nullable == SQL_NO_NULLS)
|
||||
|
@ -798,7 +798,6 @@ QSqlRecord QPSQLResult::record() const
|
||||
|
||||
f.setLength(len);
|
||||
f.setPrecision(precision);
|
||||
f.setSqlType(ptype);
|
||||
info.append(f);
|
||||
}
|
||||
return info;
|
||||
@ -1414,7 +1413,6 @@ QSqlRecord QPSQLDriver::record(const QString &tablename) const
|
||||
f.setLength(len);
|
||||
f.setPrecision(precision);
|
||||
f.setDefaultValue(defVal);
|
||||
f.setSqlType(query.value(1).toInt());
|
||||
info.append(f);
|
||||
}
|
||||
|
||||
|
@ -247,7 +247,6 @@ void QSQLiteResultPrivate::initColumns(bool emptyResultset)
|
||||
}
|
||||
|
||||
QSqlField fld(colName, QMetaType(fieldType), tableName);
|
||||
fld.setSqlType(stp);
|
||||
rInf.append(fld);
|
||||
}
|
||||
}
|
||||
|
@ -223,6 +223,7 @@ void QSqlField::setDefaultValue(const QVariant &value)
|
||||
|
||||
/*!
|
||||
\internal
|
||||
\deprecated [6.8] This internal value is no longer used.
|
||||
*/
|
||||
void QSqlField::setSqlType(int type)
|
||||
{
|
||||
@ -471,6 +472,7 @@ QVariant QSqlField::defaultValue() const
|
||||
|
||||
/*!
|
||||
\internal
|
||||
\deprecated [6.8] This internal value is no longer used.
|
||||
|
||||
Returns the type ID for the field.
|
||||
|
||||
@ -523,8 +525,6 @@ QDebug operator<<(QDebug dbg, const QSqlField &f)
|
||||
dbg << ", required: "
|
||||
<< (f.requiredStatus() == QSqlField::Required ? "yes" : "no");
|
||||
dbg << ", generated: " << (f.isGenerated() ? "yes" : "no");
|
||||
if (f.typeID() >= 0)
|
||||
dbg << ", typeID: " << f.typeID();
|
||||
if (!f.defaultValue().isNull())
|
||||
dbg << ", defaultValue: \"" << f.defaultValue() << '\"';
|
||||
dbg << ", autoValue: " << f.isAutoValue()
|
||||
|
@ -82,7 +82,6 @@ public:
|
||||
void setLength(int fieldLength);
|
||||
void setPrecision(int precision);
|
||||
void setDefaultValue(const QVariant &value);
|
||||
void setSqlType(int type);
|
||||
void setGenerated(bool gen);
|
||||
void setAutoValue(bool autoVal);
|
||||
|
||||
@ -90,10 +89,15 @@ public:
|
||||
int length() const;
|
||||
int precision() const;
|
||||
QVariant defaultValue() const;
|
||||
int typeID() const;
|
||||
bool isGenerated() const;
|
||||
bool isValid() const;
|
||||
|
||||
#if QT_DEPRECATED_SINCE(6, 8)
|
||||
QT_DEPRECATED_VERSION_X_6_8("This internal value is no longer used.")
|
||||
void setSqlType(int type);
|
||||
QT_DEPRECATED_VERSION_X_6_8("This internal value is no longer used.")
|
||||
int typeID() const;
|
||||
#endif
|
||||
private:
|
||||
void detach();
|
||||
// ### Qt7: move to private class
|
||||
|
Loading…
x
Reference in New Issue
Block a user