wine-staging/patches/odbc32-fixes/0005-odbc32-SQLGetDiagRec-W-handle-fallback-function.patch
Alistair Leslie-Hughes ad13b6a9e1 Added odbc32-fixes patchset
This fixes issue with the current odcb32 for writing to database
and support for ODBC v2.0.

This is a replacement for odbc-remove-unixodbc as ODBC32 now supports both unixODBC and native drivers.
2024-07-15 07:21:29 +10:00

69 lines
3.4 KiB
Diff

From e934286dc1be469392c92cbca9d862d33edfd9e7 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Fri, 12 Jul 2024 14:29:17 +1000
Subject: [PATCH] odbc32: SQLGetDiagRec/W handle fallback function
---
dlls/odbc32/proxyodbc.c | 37 ++++++++++++++++++++++++++++++++++---
1 file changed, 34 insertions(+), 3 deletions(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
index 31a789b26a4..e955c5f86f7 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -1807,8 +1807,23 @@ SQLRETURN WINAPI SQLGetDiagRec(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMAL
}
else if (handle->win32_handle)
{
- ret = handle->win32_funcs->SQLGetDiagRec( HandleType, handle->win32_handle, RecNumber, SqlState, NativeError,
+ if (handle->win32_funcs->SQLGetDiagRec)
+ {
+ ret = handle->win32_funcs->SQLGetDiagRec( HandleType, handle->win32_handle, RecNumber, SqlState, NativeError,
MessageText, BufferLength, TextLength );
+ }
+ else if (handle->win32_funcs->SQLError)
+ {
+ if (HandleType == SQL_HANDLE_ENV)
+ ret = handle->win32_funcs->SQLError(handle->win32_handle, SQL_NULL_HDBC, SQL_NULL_HSTMT,
+ SqlState, NativeError, MessageText, BufferLength, TextLength);
+ else if (HandleType == SQL_HANDLE_DBC)
+ ret = handle->win32_funcs->SQLError(SQL_NULL_HENV, handle->win32_handle, SQL_NULL_HSTMT,
+ SqlState, NativeError, MessageText, BufferLength, TextLength);
+ else if (HandleType == SQL_HANDLE_STMT)
+ ret = handle->win32_funcs->SQLError(SQL_NULL_HENV, SQL_NULL_HDBC, handle->win32_handle,
+ SqlState, NativeError, MessageText, BufferLength, TextLength);
+ }
}
TRACE("Returning %d\n", ret);
@@ -4012,8 +4027,24 @@ SQLRETURN WINAPI SQLGetDiagRecW(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMA
}
else if (handle->win32_handle)
{
- ret = handle->win32_funcs->SQLGetDiagRecW( HandleType, handle->win32_handle, RecNumber, SqlState, NativeError,
- MessageText, BufferLength, TextLength );
+ if (handle->win32_funcs->SQLGetDiagRecW)
+ {
+ ret = handle->win32_funcs->SQLGetDiagRecW( HandleType, handle->win32_handle, RecNumber, SqlState,
+ NativeError, MessageText, BufferLength, TextLength );
+ }
+ else if (handle->win32_funcs->SQLErrorW)
+ {
+ /* ODBC v2 */
+ if (HandleType == SQL_HANDLE_ENV)
+ ret = handle->win32_funcs->SQLErrorW(handle->win32_handle, SQL_NULL_HDBC, SQL_NULL_HSTMT,
+ SqlState, NativeError, MessageText, BufferLength, TextLength);
+ else if (HandleType == SQL_HANDLE_DBC)
+ ret = handle->win32_funcs->SQLErrorW(SQL_NULL_HENV, handle->win32_handle, SQL_NULL_HSTMT,
+ SqlState, NativeError, MessageText, BufferLength, TextLength);
+ else if (HandleType == SQL_HANDLE_STMT)
+ ret = handle->win32_funcs->SQLErrorW(SQL_NULL_HENV, SQL_NULL_HDBC, handle->win32_handle,
+ SqlState, NativeError, MessageText, BufferLength, TextLength);
+ }
}
TRACE("Returning %d\n", ret);
--
2.43.0