SQL/ODBC: Pass correct length to SQLColAttribute()
This ensures the tst_QSqlQuery::record() test passes when checking the tablename. Pick-to: 6.5 6.4 6.2 5.15 Change-Id: I146f9f627ea366c6813af61ce48b930ca1041b15 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>bb10
parent
c5a2257e0b
commit
9ea00c70fb
|
|
@ -702,10 +702,15 @@ static QSqlField qMakeFieldInfo(const SQLHANDLE hStmt, int i, QString *errorMess
|
|||
f.setAutoValue(isAutoValue(hStmt, i));
|
||||
QVarLengthArray<SQLTCHAR> tableName(TABLENAMESIZE);
|
||||
SQLSMALLINT tableNameLen;
|
||||
r = SQLColAttribute(hStmt, i + 1, SQL_DESC_BASE_TABLE_NAME, tableName.data(),
|
||||
TABLENAMESIZE, &tableNameLen, 0);
|
||||
r = SQLColAttribute(hStmt,
|
||||
i + 1,
|
||||
SQL_DESC_BASE_TABLE_NAME,
|
||||
tableName.data(),
|
||||
SQLSMALLINT(tableName.size() * sizeof(SQLTCHAR)), // SQLColAttribute needs/returns size in bytes
|
||||
&tableNameLen,
|
||||
0);
|
||||
if (r == SQL_SUCCESS)
|
||||
f.setTableName(fromSQLTCHAR(tableName, tableNameLen));
|
||||
f.setTableName(fromSQLTCHAR(tableName, tableNameLen / sizeof(SQLTCHAR)));
|
||||
return f;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue