Files
wine-staging/patches/odbc32-fixes/0021-odbc32-SQLExecDirectW-call-fallback-SQLExecDirect.patch

58 lines
2.0 KiB
Diff
Raw Permalink Normal View History

From 6beecab75df0c60ccde26fe8571172166efd5d72 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Sat, 26 Apr 2025 17:07:21 +1000
Subject: [PATCH] odbc32: SQLExecDirectW call fallback SQLExecDirect
---
dlls/odbc32/proxyodbc.c | 25 +++++++++++++++++++++++--
1 file changed, 23 insertions(+), 2 deletions(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
index e8b05a7b9ec..b792fcbe603 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -1099,6 +1099,20 @@ static SQLWCHAR *strnAtoW( const SQLCHAR *str, int len )
return ret;
}
+static inline char *strdupWtoA(const WCHAR *str)
+{
+ char *ret = NULL;
+
+ if(str) {
+ DWORD size = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
+ ret = malloc(size);
+ if(ret)
+ WideCharToMultiByte(CP_ACP, 0, str, -1, ret, size, NULL, NULL);
+ }
+
+ return ret;
+}
+
static SQLRETURN columns_unix_a( struct statement *stmt, SQLCHAR *catalog, SQLSMALLINT len1, SQLCHAR *schema,
SQLSMALLINT len2, SQLCHAR *table, SQLSMALLINT len3, SQLCHAR *column,
SQLSMALLINT len4 )
@@ -6073,10 +6087,17 @@ static SQLRETURN exec_direct_unix_w( struct statement *stmt, SQLWCHAR *text, SQL
static SQLRETURN exec_direct_win32_w( struct statement *stmt, SQLWCHAR *text, SQLINTEGER len )
{
+ SQLRETURN ret = SQL_ERROR;
+
if (stmt->hdr.win32_funcs->SQLExecDirectW)
return stmt->hdr.win32_funcs->SQLExecDirectW( stmt->hdr.win32_handle, text, len );
- if (stmt->hdr.win32_funcs->SQLExecDirect) FIXME( "Unicode to ANSI conversion not handled\n" );
- return SQL_ERROR;
+ if (stmt->hdr.win32_funcs->SQLExecDirect)
+ {
+ SQLCHAR *textA = (SQLCHAR*)strdupWtoA( text );
+ ret = stmt->hdr.win32_funcs->SQLExecDirect( stmt->hdr.win32_handle, textA, len );
+ free(textA);
+ }
+ return ret;
}
/*************************************************************************
--
2.47.2