mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-11-21 16:46:54 -08:00
75 lines
2.0 KiB
Diff
75 lines
2.0 KiB
Diff
|
From b866665b60bc2c29105d45a0e071db8e259ac229 Mon Sep 17 00:00:00 2001
|
||
|
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
||
|
Date: Fri, 3 Feb 2023 11:44:19 +1100
|
||
|
Subject: [PATCH 02/42] odbc32: Implement SQLAllocEnv/SQLFreeEnv
|
||
|
|
||
|
---
|
||
|
dlls/odbc32/proxyodbc.c | 31 +++++++++++++++++++++++++------
|
||
|
1 file changed, 25 insertions(+), 6 deletions(-)
|
||
|
|
||
|
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
|
||
|
index e8574430e74..24e84883aa5 100644
|
||
|
--- a/dlls/odbc32/proxyodbc.c
|
||
|
+++ b/dlls/odbc32/proxyodbc.c
|
||
|
@@ -43,6 +43,11 @@
|
||
|
|
||
|
WINE_DEFAULT_DEBUG_CHANNEL(odbc);
|
||
|
|
||
|
+struct SQLHENV_data
|
||
|
+{
|
||
|
+ int type;
|
||
|
+};
|
||
|
+
|
||
|
|
||
|
/*************************************************************************
|
||
|
* SQLAllocConnect [ODBC32.001]
|
||
|
@@ -61,13 +66,23 @@ SQLRETURN WINAPI SQLAllocConnect(SQLHENV EnvironmentHandle, SQLHDBC *ConnectionH
|
||
|
*/
|
||
|
SQLRETURN WINAPI SQLAllocEnv(SQLHENV *EnvironmentHandle)
|
||
|
{
|
||
|
- SQLRETURN ret = SQL_ERROR;
|
||
|
+ struct SQLHENV_data *henv;
|
||
|
|
||
|
- FIXME("(EnvironmentHandle %p)\n", EnvironmentHandle);
|
||
|
+ TRACE("(EnvironmentHandle %p)\n", EnvironmentHandle);
|
||
|
+
|
||
|
+ if (!EnvironmentHandle)
|
||
|
+ return SQL_ERROR;
|
||
|
|
||
|
*EnvironmentHandle = SQL_NULL_HENV;
|
||
|
+ henv = calloc(1, sizeof(*henv));
|
||
|
+ if (!henv)
|
||
|
+ return SQL_ERROR;
|
||
|
|
||
|
- return ret;
|
||
|
+ henv->type = SQL_HANDLE_ENV;
|
||
|
+
|
||
|
+ *EnvironmentHandle = henv;
|
||
|
+
|
||
|
+ return SQL_SUCCESS;
|
||
|
}
|
||
|
|
||
|
/*************************************************************************
|
||
|
@@ -399,11 +414,15 @@ SQLRETURN WINAPI SQLFreeConnect(SQLHDBC ConnectionHandle)
|
||
|
*/
|
||
|
SQLRETURN WINAPI SQLFreeEnv(SQLHENV EnvironmentHandle)
|
||
|
{
|
||
|
- SQLRETURN ret = SQL_ERROR;
|
||
|
+ struct SQLHENV_data *data = EnvironmentHandle;
|
||
|
+ TRACE("(EnvironmentHandle %p)\n", EnvironmentHandle);
|
||
|
|
||
|
- FIXME("(EnvironmentHandle %p)\n", EnvironmentHandle);
|
||
|
+ if (data && data->type != SQL_HANDLE_ENV)
|
||
|
+ WARN("EnvironmentHandle isn't of type SQL_HANDLE_ENV\n");
|
||
|
+ else
|
||
|
+ free(data);
|
||
|
|
||
|
- return ret;
|
||
|
+ return SQL_SUCCESS;
|
||
|
}
|
||
|
|
||
|
/*************************************************************************
|
||
|
--
|
||
|
2.39.1
|
||
|
|