wine-staging/patches/odbc32-fixes/0013-odbc32-SQLTransact-handle-NULL-EnvironmentHandle.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

46 lines
1.8 KiB
Diff

From 35dec93c2df3b2a4db6fe63036669ba7ccdd3806 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Sun, 14 Jul 2024 19:02:11 +1000
Subject: [PATCH] odbc32: SQLTransact handle NULL EnvironmentHandle
---
dlls/odbc32/proxyodbc.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
index 89d2cc29b71..30f3d5f34e9 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -2655,16 +2655,23 @@ SQLRETURN WINAPI SQLTransact(SQLHENV EnvironmentHandle, SQLHDBC ConnectionHandle
TRACE("(EnvironmentHandle %p, ConnectionHandle %p, CompletionType %d)\n", EnvironmentHandle, ConnectionHandle,
CompletionType);
- if (!env || !con) return SQL_INVALID_HANDLE;
+ if (!env && !con) return SQL_INVALID_HANDLE;
- if (env->unix_handle)
+ if ( (env && env->unix_handle) || (con && con->unix_handle))
{
- struct SQLTransact_params params = { env->unix_handle, con->unix_handle, CompletionType };
+ struct SQLTransact_params params = { env ? env->unix_handle : 0,
+ con ? con->unix_handle : 0, CompletionType };
ret = ODBC_CALL( SQLTransact, &params );
}
- else if (env->win32_handle)
+ else if ( (env && env->win32_handle) || (con && con->win32_handle))
{
- ret = env->win32_funcs->SQLTransact( env->win32_handle, con->win32_handle, CompletionType );
+ const struct win32_funcs *win32_funcs = NULL;
+
+ if (env) win32_funcs = env->win32_funcs;
+ else if (con) win32_funcs = con->win32_funcs;
+
+ ret = win32_funcs->SQLTransact( env ? env->win32_handle : NULL,
+ con ? con->win32_handle : NULL, CompletionType );
}
TRACE("Returning %d\n", ret);
--
2.43.0