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