You've already forked wine-staging
mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2025-09-12 18:50:20 -07:00
Some older ANSI drivers have a limit on the number of environment handles that can be created. So reuse existing environment variable for each connection when possible.
62 lines
2.6 KiB
Diff
62 lines
2.6 KiB
Diff
From 2af873781003a7daa60c8e7f4652afb0d8097009 Mon Sep 17 00:00:00 2001
|
|
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
|
Date: Wed, 7 May 2025 14:26:13 +1000
|
|
Subject: [PATCH] odbc32: SQLDriverConnect/W reuse environment handle is
|
|
possible
|
|
|
|
---
|
|
dlls/odbc32/proxyodbc.c | 16 ++++++++++++++--
|
|
1 file changed, 14 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
|
|
index 770b455ad5d..93c0ddc817c 100644
|
|
--- a/dlls/odbc32/proxyodbc.c
|
|
+++ b/dlls/odbc32/proxyodbc.c
|
|
@@ -5792,6 +5792,8 @@ SQLRETURN WINAPI SQLDriverConnect(SQLHDBC ConnectionHandle, SQLHWND WindowHandle
|
|
|
|
if (has_suffix( filename, L".dll" ))
|
|
{
|
|
+ struct environment *env;
|
|
+
|
|
if (!(con->hdr.win32_funcs = con->hdr.parent->win32_funcs = load_driver( filename )))
|
|
{
|
|
WARN( "failed to load driver %s\n", debugstr_w(filename) );
|
|
@@ -5799,7 +5801,11 @@ SQLRETURN WINAPI SQLDriverConnect(SQLHDBC ConnectionHandle, SQLHWND WindowHandle
|
|
}
|
|
TRACE( "using Windows driver %s\n", debugstr_w(filename) );
|
|
|
|
- if (!SUCCESS((ret = create_env( (struct environment *)con->hdr.parent, FALSE )))) goto done;
|
|
+ env = (struct environment *)find_object_type(SQL_HANDLE_ENV, con->hdr.parent);
|
|
+ if (!env || !env->hdr.win32_handle)
|
|
+ {
|
|
+ if (!SUCCESS((ret = create_env( (struct environment *)con->hdr.parent, FALSE )))) goto done;
|
|
+ }
|
|
if (!SUCCESS((ret = create_con( con )))) goto done;
|
|
|
|
ret = driver_connect_win32_a( con, WindowHandle, strA, Length, OutConnectionString, BufferLength, Length2,
|
|
@@ -7179,6 +7185,7 @@ SQLRETURN WINAPI SQLDriverConnectW(SQLHDBC ConnectionHandle, SQLHWND WindowHandl
|
|
|
|
if (has_suffix( filename, L".dll" ))
|
|
{
|
|
+ struct environment *env;
|
|
if (!(con->hdr.win32_funcs = con->hdr.parent->win32_funcs = load_driver( filename )))
|
|
{
|
|
WARN( "failed to load driver %s\n", debugstr_w(filename) );
|
|
@@ -7186,7 +7193,12 @@ SQLRETURN WINAPI SQLDriverConnectW(SQLHDBC ConnectionHandle, SQLHWND WindowHandl
|
|
}
|
|
TRACE( "using Windows driver %s\n", debugstr_w(filename) );
|
|
|
|
- if (!SUCCESS((ret = create_env( (struct environment *)con->hdr.parent, FALSE )))) goto done;
|
|
+ env = (struct environment *)find_object_type(SQL_HANDLE_ENV, con->hdr.parent);
|
|
+ if (!env || !env->hdr.win32_handle)
|
|
+ {
|
|
+ if (!SUCCESS((ret = create_env( (struct environment *)con->hdr.parent, FALSE )))) goto done;
|
|
+ }
|
|
+
|
|
if (!SUCCESS((ret = create_con( con )))) goto done;
|
|
|
|
ret = driver_connect_win32_w( con, WindowHandle, InConnectionString, Length, OutConnectionString,
|
|
--
|
|
2.47.2
|
|
|