Files
wine-staging/patches/odbc32-fixes/0019-odbc32-SQLNativeSqlW-add-ANSI-fallback.patch
Alistair Leslie-Hughes 3714d05e91 Updated odbc32-fixes patchset
2025-09-08 09:54:01 +10:00

53 lines
2.0 KiB
Diff

From 472c0a3a3962a82dc17fc3c0aa2dc6ed5ade8b22 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Thu, 1 May 2025 08:05:31 +1000
Subject: [PATCH] odbc32: SQLNativeSqlW add ANSI fallback
---
dlls/odbc32/proxyodbc.c | 26 ++++++++++++++++++++++++--
1 file changed, 24 insertions(+), 2 deletions(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
index 4ff20236cce..416d5aa77fa 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -7895,11 +7895,33 @@ static SQLRETURN native_sql_unix_w( struct connection *con, SQLWCHAR *in_stateme
static SQLRETURN native_sql_win32_w( struct connection *con, SQLWCHAR *in_statement, SQLINTEGER len,
SQLWCHAR *out_statement, SQLINTEGER buflen, SQLINTEGER *retlen )
{
+ SQLRETURN ret = SQL_ERROR;
+
if (con->hdr.win32_funcs->SQLNativeSqlW)
return con->hdr.win32_funcs->SQLNativeSqlW( con->hdr.win32_handle, in_statement, len, out_statement, buflen,
retlen );
- if (con->hdr.win32_funcs->SQLNativeSql) FIXME( "Unicode to ANSI conversion not handled\n" );
- return SQL_ERROR;
+ if (con->hdr.win32_funcs->SQLNativeSql)
+ {
+ SQLCHAR *statement = (SQLCHAR*)strdupWtoA( (WCHAR*)in_statement );
+ SQLCHAR *out = NULL;
+ if (buflen)
+ out = malloc( buflen );
+
+ ret = con->hdr.win32_funcs->SQLNativeSql( con->hdr.win32_handle, statement, len, out, buflen, retlen );
+ if(ret == SQL_SUCCESS)
+ {
+ if (out_statement)
+ {
+ MultiByteToWideChar( CP_ACP, 0, (const char *)out, len, out_statement, buflen );
+ out_statement[buflen] = 0;
+ }
+ }
+ if (retlen) *retlen *= sizeof(WCHAR);
+
+ free( statement );
+ free( out );
+ }
+ return ret;
}
/*************************************************************************
--
2.50.1