Files
wine-staging/patches/odbc32-fixes/0022-odbc32-SQLBindCol-remap-unicode-field-when-using-ANS.patch
Alistair Leslie-Hughes f95009bb3e Updated odbc32-fixes patchset
Corrected Commit ascii to ANSI.
Reset patch numbers.
Convert SQL_C_WCHAR to SQL_CHAR when required for ANSI driver.
2025-05-05 11:54:43 +10:00

61 lines
2.6 KiB
Diff

From e8d33e2603801f65e1ecdba0c903207584845400 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Fri, 2 May 2025 12:13:30 +1000
Subject: [PATCH 2/4] odbc32: SQLBindCol remap unicode field when using ANSI
driver
---
dlls/odbc32/proxyodbc.c | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
index ce69e3ae134..07e94c80ded 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -809,9 +809,42 @@ static SQLRETURN bind_col_unix( struct statement *stmt, SQLUSMALLINT column, SQL
}
}
+static BOOL driver_ansi_only( const struct win32_funcs *funcs )
+{
+ BOOL ansi = !( funcs->SQLBrowseConnectW || funcs->SQLColAttributeW || funcs->SQLColAttributesW ||
+ funcs->SQLColumnPrivilegesW || funcs->SQLColumnsW || funcs->SQLConnectW ||
+ funcs->SQLDescribeColW || funcs->SQLDriverConnectW || funcs->SQLErrorW ||
+ funcs->SQLExecDirectW || funcs->SQLGetConnectAttrW || funcs->SQLGetConnectOptionW ||
+ funcs->SQLGetCursorNameW || funcs->SQLGetDescFieldW || funcs->SQLGetDescRecW ||
+ funcs->SQLGetDiagFieldW || funcs->SQLGetDiagRecW || funcs->SQLGetInfoW ||
+ funcs->SQLGetStmtAttrW || funcs->SQLGetTypeInfoW || funcs->SQLNativeSqlW ||
+ funcs->SQLPrepareW || funcs->SQLPrimaryKeysW || funcs->SQLProceduresW ||
+ funcs->SQLSetConnectAttrW || funcs->SQLSetConnectOptionW || funcs->SQLSetCursorNameW ||
+ funcs->SQLSetDescFieldW || funcs->SQLSetStmtAttrW || funcs->SQLSpecialColumnsW ||
+ funcs->SQLStatisticsW || funcs->SQLTablePrivilegesW || funcs->SQLTablesW );
+
+ return ansi;
+}
+
static SQLRETURN bind_col_win32( struct statement *stmt, SQLUSMALLINT column, SQLSMALLINT type, SQLPOINTER value,
SQLLEN buflen, SQLLEN *retlen )
{
+ if ( driver_ansi_only(stmt->hdr.win32_funcs) )
+ {
+ UINT i = column - 1;
+ SQLSMALLINT orig_type = type;
+
+ /* For ANSI Drivers we need to remap to standard char binding to stop Fetch from causing an error */
+ if (type == SQL_C_WCHAR)
+ type = SQL_CHAR;
+
+ if (!alloc_binding( &stmt->bind_col, SQL_PARAM_INPUT_OUTPUT, column, stmt->row_count ))
+ return SQL_ERROR;
+
+ stmt->bind_col.param[i].col.target_type = type;
+ stmt->bind_col.param[i].col.target_value = value;
+ stmt->bind_col.param[i].col.buffer_length = orig_type;
+ }
if (stmt->hdr.win32_funcs->SQLBindCol)
return stmt->hdr.win32_funcs->SQLBindCol( stmt->hdr.win32_handle, column, type, value, buflen, retlen );
return SQL_ERROR;
--
2.47.2