Hans Leidekker : odbc32: Work around drivers that don' t accept NULL name length in SQLDescribeCol.

Alexandre Julliard julliard at winehq.org
Wed Feb 6 15:32:28 CST 2019


Module: wine
Branch: master
Commit: 74b2dc01c6c4c84d7759764ca30946c92b7f353f
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=74b2dc01c6c4c84d7759764ca30946c92b7f353f

Author: Hans Leidekker <hans at codeweavers.com>
Date:   Tue Feb  5 21:22:56 2019 +0100

odbc32: Work around drivers that don't accept NULL name length in SQLDescribeCol.

Signed-off-by: Hans Leidekker <hans at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/odbc32/proxyodbc.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
index 13546ed..ab28506 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -1020,6 +1020,7 @@ SQLRETURN WINAPI ODBC32_SQLDescribeCol(SQLHSTMT StatementHandle, SQLUSMALLINT Co
                                        SQLSMALLINT BufferLength, SQLSMALLINT *NameLength, SQLSMALLINT *DataType,
                                        SQLULEN *ColumnSize, SQLSMALLINT *DecimalDigits, SQLSMALLINT *Nullable)
 {
+    SQLSMALLINT dummy;
     SQLRETURN ret;
 
     TRACE("(StatementHandle %p, ColumnNumber %d, ColumnName %p, BufferLength %d, NameLength %p, DataType %p,"
@@ -1027,6 +1028,7 @@ SQLRETURN WINAPI ODBC32_SQLDescribeCol(SQLHSTMT StatementHandle, SQLUSMALLINT Co
           BufferLength, NameLength, DataType, ColumnSize, DecimalDigits, Nullable);
 
     if (!pSQLDescribeCol) return SQL_ERROR;
+    if (!NameLength) NameLength = &dummy; /* workaround for drivers that don't accept NULL NameLength */
 
     ret = pSQLDescribeCol(StatementHandle, ColumnNumber, ColumnName, BufferLength, NameLength, DataType, ColumnSize,
                           DecimalDigits, Nullable);
@@ -2167,6 +2169,7 @@ SQLRETURN WINAPI ODBC32_SQLDescribeColW(SQLHSTMT StatementHandle, SQLUSMALLINT C
                                         SQLSMALLINT BufferLength, SQLSMALLINT *NameLength, SQLSMALLINT *DataType,
                                         SQLULEN *ColumnSize, SQLSMALLINT *DecimalDigits, SQLSMALLINT *Nullable)
 {
+    SQLSMALLINT dummy;
     SQLRETURN ret;
 
     TRACE("(StatementHandle %p, ColumnNumber %d, ColumnName %p, BufferLength %d, NameLength %p, DataType %p,"
@@ -2174,6 +2177,7 @@ SQLRETURN WINAPI ODBC32_SQLDescribeColW(SQLHSTMT StatementHandle, SQLUSMALLINT C
           BufferLength, NameLength, DataType, ColumnSize, DecimalDigits, Nullable);
 
     if (!pSQLDescribeColW) return SQL_ERROR;
+    if (!NameLength) NameLength = &dummy; /* workaround for drivers that don't accept NULL NameLength */
 
     ret = pSQLDescribeColW(StatementHandle, ColumnNumber, ColumnName, BufferLength, NameLength, DataType, ColumnSize,
                            DecimalDigits, Nullable);




More information about the wine-cvs mailing list