Files
wine-staging/patches/odbc32-fixes/0023-odbc32-SQLFetch-convert-to-ANSI-when-required.patch
Alistair Leslie-Hughes 3714d05e91 Updated odbc32-fixes patchset
2025-09-08 09:54:01 +10:00

51 lines
1.7 KiB
Diff

From 1ce21cabdc0f3b1e8fa4f631e43837326402ddab 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] 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 74d0ebe1db2..a94b31cc544 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -2055,9 +2055,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.50.1