Files
wine-staging/patches/odbc32-fixes/0023-odbc32-SQLFetch-convert-to-ANSI-when-required.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

51 lines
1.7 KiB
Diff

From 0f690546c57c6bc04fbbf3b16fc8842ce3a41300 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Mon, 5 May 2025 10:11:29 +1000
Subject: [PATCH 3/4] odbc32: SQLFetch convert to ANSI when required.
---
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 07e94c80ded..a278212b092 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -2008,9 +2008,31 @@ static SQLRETURN fetch_unix( struct statement *stmt )
static SQLRETURN fetch_win32( struct statement *stmt )
{
+ SQLRETURN ret = SQL_ERROR;
+
if (stmt->hdr.win32_funcs->SQLFetch)
- return stmt->hdr.win32_funcs->SQLFetch( stmt->hdr.win32_handle );
- return SQL_ERROR;
+ {
+ ret = stmt->hdr.win32_funcs->SQLFetch( stmt->hdr.win32_handle );
+
+ if (driver_ansi_only(stmt->hdr.win32_funcs) && stmt->bind_col.param)
+ {
+ int i;
+
+ for (i = 0; i < stmt->bind_col.count; i++)
+ {
+ /* buffer_length currently used for Original Type */
+ if (stmt->bind_col.param[i].col.buffer_length == SQL_C_WCHAR &&
+ stmt->bind_col.param[i].col.target_type != stmt->bind_col.param[i].col.buffer_length)
+ {
+ WCHAR *str = strnAtoW(stmt->bind_col.param[i].col.target_value, -1);
+ wcscpy(stmt->bind_col.param[i].col.target_value, str);
+ free(str);
+ }
+ }
+ }
+ }
+
+ return ret;
}
/*************************************************************************
--
2.47.2