Alistair Leslie-Hughes : msdasql: Use SQLColAttributesW to fetch statement attributes.
Module: wine Branch: master Commit: ec9610c46b47afbc71030ada6420fa400e48097a URL: https://gitlab.winehq.org/wine/wine/-/commit/ec9610c46b47afbc71030ada6420fa4... Author: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com> Date: Thu Feb 9 09:56:33 2023 +1100 msdasql: Use SQLColAttributesW to fetch statement attributes. We need to use the ODBC v1 function SQLColAttributesW, to ensure that we use the lowest verion available. This ODBC function internally will call SQLColAttribute or SQLColAttributesW depending on what the driver supports. --- dlls/msdasql/session.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/dlls/msdasql/session.c b/dlls/msdasql/session.c index 1e6d2660068..588be365b72 100644 --- a/dlls/msdasql/session.c +++ b/dlls/msdasql/session.c @@ -1029,9 +1029,10 @@ static HRESULT WINAPI rowset_colsinfo_GetColumnInfo(IColumnsInfo *iface, DBORDIN dbcolumn[i].pTypeInfo = NULL; dbcolumn[i].iOrdinal = i+1; - ret = SQLColAttribute(rowset->hstmt, i+1, SQL_DESC_UNSIGNED, NULL, 0, NULL, &length); + ret = SQLColAttributesW (rowset->hstmt, i+1, SQL_DESC_UNSIGNED, NULL, 0, NULL, &length); if (!SQL_SUCCEEDED(ret)) { + dump_sql_diag_records(SQL_HANDLE_STMT, rowset->hstmt); CoTaskMemFree(ptr); CoTaskMemFree(dbcolumn); ERR("Failed to get column %d attribute\n", i+1); @@ -1043,7 +1044,7 @@ static HRESULT WINAPI rowset_colsinfo_GetColumnInfo(IColumnsInfo *iface, DBORDIN dbcolumn[i].dwFlags = DBCOLUMNFLAGS_WRITE; - ret = SQLColAttribute(rowset->hstmt, i+1, SQL_DESC_LENGTH, NULL, 0, NULL, &length); + ret = SQLColAttributesW(rowset->hstmt, i+1, SQL_DESC_LENGTH, NULL, 0, NULL, &length); if (!SQL_SUCCEEDED(ret)) { CoTaskMemFree(ptr); @@ -1062,7 +1063,7 @@ static HRESULT WINAPI rowset_colsinfo_GetColumnInfo(IColumnsInfo *iface, DBORDIN if (is_fixed_length(ColumnDataType)) dbcolumn[i].dwFlags |= DBCOLUMNFLAGS_ISFIXEDLENGTH; - ret = SQLColAttribute(rowset->hstmt, i+1, SQL_DESC_SCALE, NULL, 0, NULL, &length); + ret = SQLColAttributesW(rowset->hstmt, i+1, SQL_DESC_SCALE, NULL, 0, NULL, &length); if (!SQL_SUCCEEDED(ret)) { CoTaskMemFree(ptr); @@ -1074,7 +1075,7 @@ static HRESULT WINAPI rowset_colsinfo_GetColumnInfo(IColumnsInfo *iface, DBORDIN length = 255; dbcolumn[i].bScale = length; - ret = SQLColAttribute(rowset->hstmt, i+1, SQL_DESC_PRECISION, NULL, 0, NULL, &length); + ret = SQLColAttributesW(rowset->hstmt, i+1, SQL_DESC_PRECISION, NULL, 0, NULL, &length); if (!SQL_SUCCEEDED(ret)) { CoTaskMemFree(ptr);
participants (1)
-
Alexandre Julliard