wine-staging/patches/odbc-remove-unixodbc/0049-odbc32-Implement-SQLFreeHandle.patch
Alistair Leslie-Hughes 14f63f40e7 Updated odbc-remove-unixodbc patchset
Instead of removing unixODBC completely. Creating an wine ODBC driver for unixODBC.
This way native and unixODBC drivers can be used.

This is a WIP.
2024-06-23 17:08:33 +10:00

65 lines
1.9 KiB
Diff

From 506812cfd989ab515dd0c0fd11bc64dc4cdcdae7 Mon Sep 17 00:00:00 2001
From: Steve Fawcett <steve.fawcett@bitnosis.com>
Date: Wed, 12 Jun 2024 09:27:31 +1000
Subject: [PATCH] odbc32: Implement SQLFreeHandle
---
dlls/odbc32/proxyodbc.c | 40 +++++++++++++++++++++++++++++++++++++++-
1 file changed, 39 insertions(+), 1 deletion(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
index ce2a74310bb..a49fb0e82b9 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -929,8 +929,46 @@ SQLRETURN WINAPI SQLFreeHandle(SQLSMALLINT HandleType, SQLHANDLE Handle)
{
SQLRETURN ret = SQL_ERROR;
- FIXME("(HandleType %d, Handle %p)\n", HandleType, Handle);
+ TRACE("HandleType %d, Handle %p\n", HandleType, Handle);
+ if (HandleType == SQL_HANDLE_ENV)
+ {
+ struct SQLHENV_data *henv = Handle;
+
+ if (henv && henv->type != SQL_HANDLE_ENV)
+ WARN("EnvironmentHandle isn't of type SQL_HANDLE_ENV\n");
+ else {
+ henv->type = 0;
+ free(henv);
+ ret = SQL_SUCCESS;
+ }
+ }
+ else if (HandleType == SQL_HANDLE_DBC)
+ {
+ struct SQLHDBC_data *hdbc = Handle;
+
+ if (hdbc->pSQLFreeHandle)
+ ret = hdbc->pSQLFreeHandle(HandleType, hdbc->driver_hdbc);
+ else if (hdbc->pSQLFreeConnect)
+ ret = hdbc->pSQLFreeConnect(hdbc->driver_hdbc);
+
+ hdbc->type = 0;
+ free(hdbc);
+ }
+ else if (HandleType == SQL_HANDLE_STMT)
+ {
+ struct SQLHSTMT_data *statement = Handle;
+
+ if (statement->connection->pSQLFreeHandle)
+ ret = statement->connection->pSQLFreeHandle(HandleType, statement->driver_stmt);
+ else if (statement->connection->pSQLFreeStmt)
+ ret = statement->connection->pSQLFreeStmt(statement->driver_stmt, SQL_CLOSE);
+
+ statement->type = 0;
+ free(statement);
+ }
+
+ TRACE("ret %d\n", ret);
return ret;
}
--
2.43.0