wine-staging/patches/odbc-remove-unixodbc/0003-odbc32-Implement-SQLAllocEnv-SQLFreeEnv.patch

75 lines
2.0 KiB
Diff
Raw Normal View History

From 4f4f45e8aad723b7372d422f01df15e2320d23d6 Mon Sep 17 00:00:00 2001
2023-02-16 15:44:46 -08:00
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Fri, 3 Feb 2023 11:44:19 +1100
Subject: [PATCH] odbc32: Implement SQLAllocEnv/SQLFreeEnv
2023-02-16 15:44:46 -08:00
---
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 89e4545f068..48ba33bb0f5 100644
2023-02-16 15:44:46 -08:00
--- 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.43.0
2023-02-16 15:44:46 -08:00