Files
wine-staging/patches/odbc32-fixes/0011-odbc32-SQLExecDirectW-call-fallback-SQLExecDirect.patch
Alistair Leslie-Hughes 3714d05e91 Updated odbc32-fixes patchset
2025-09-08 09:54:01 +10:00

58 lines
2.0 KiB
Diff

From 8b2a6e19672b17ea61b2b4b5e141368a988ec9cf 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 e18117d5ad8..aace16cde55 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -1113,6 +1113,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 )
@@ -6148,10 +6162,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.50.1