SQL/ODBC: remove unneeded qMakeFieldInfo(... QString *errMsg)

This function can be merged with the other overload of qMakeFieldInfo()
because no-one uses it except qMakeFieldInfo() itself.

Change-Id: I7ed07ac0c673801fed9c00c9b0ce1628cfea3837
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
(cherry picked from commit 686f953bdb05f3e68de8c847fb4054e6cd91cde8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Christian Ehrlicher 2024-01-21 18:01:40 +01:00 committed by Qt Cherry-pick Bot
parent c374e51277
commit d55d8d9620

View File

@ -566,8 +566,6 @@ static bool isAutoValue(const SQLHANDLE hStmt, int column)
return nNumericAttribute != SQL_FALSE;
}
static QSqlField qMakeFieldInfo(const SQLHANDLE hStmt, int i, QString *errorMessage);
// creates a QSqlField from a valid hStmt generated
// by SQLColumns. The hStmt has to point to a valid position.
static QSqlField qMakeFieldInfo(const SQLHANDLE hStmt, const QODBCDriverPrivate* p)
@ -590,16 +588,7 @@ static QSqlField qMakeFieldInfo(const SQLHANDLE hStmt, const QODBCDriverPrivate*
return f;
}
static QSqlField qMakeFieldInfo(const QODBCResultPrivate* p, int i )
{
QString errorMessage;
const QSqlField result = qMakeFieldInfo(p->hStmt, i, &errorMessage);
if (!errorMessage.isEmpty())
qSqlWarning(errorMessage, p);
return result;
}
static QSqlField qMakeFieldInfo(const SQLHANDLE hStmt, int i, QString *errorMessage)
static QSqlField qMakeFieldInfo(const QODBCResultPrivate *p, int i)
{
SQLSMALLINT colNameLen;
SQLSMALLINT colType;
@ -608,8 +597,7 @@ static QSqlField qMakeFieldInfo(const SQLHANDLE hStmt, int i, QString *errorMess
SQLSMALLINT nullable;
SQLRETURN r = SQL_ERROR;
QVarLengthArray<SQLTCHAR, COLNAMESIZE> colName(COLNAMESIZE);
errorMessage->clear();
r = SQLDescribeCol(hStmt,
r = SQLDescribeCol(p->hStmt,
i+1,
colName.data(), SQLSMALLINT(colName.size()),
&colNameLen,
@ -619,12 +607,12 @@ static QSqlField qMakeFieldInfo(const SQLHANDLE hStmt, int i, QString *errorMess
&nullable);
if (r != SQL_SUCCESS) {
*errorMessage = QStringLiteral("qMakeField: Unable to describe column ") + QString::number(i);
qSqlWarning(QStringLiteral("qMakeField: Unable to describe column ") + QString::number(i), p);
return QSqlField();
}
SQLLEN unsignedFlag = SQL_FALSE;
r = SQLColAttribute (hStmt,
r = SQLColAttribute (p->hStmt,
i + 1,
SQL_DESC_UNSIGNED,
0,
@ -633,7 +621,7 @@ static QSqlField qMakeFieldInfo(const SQLHANDLE hStmt, int i, QString *errorMess
&unsignedFlag);
if (r != SQL_SUCCESS) {
qSqlWarning(QStringLiteral("qMakeField: Unable to get column attributes for column ")
+ QString::number(i), hStmt);
+ QString::number(i), p);
}
const QString qColName(fromSQLTCHAR(colName, colNameLen));
@ -648,10 +636,10 @@ static QSqlField qMakeFieldInfo(const SQLHANDLE hStmt, int i, QString *errorMess
else if (nullable == SQL_NULLABLE)
f.setRequired(false);
// else we don't know
f.setAutoValue(isAutoValue(hStmt, i));
f.setAutoValue(isAutoValue(p->hStmt, i));
QVarLengthArray<SQLTCHAR, TABLENAMESIZE> tableName(TABLENAMESIZE);
SQLSMALLINT tableNameLen;
r = SQLColAttribute(hStmt,
r = SQLColAttribute(p->hStmt,
i + 1,
SQL_DESC_BASE_TABLE_NAME,
tableName.data(),