diff --git a/patches/odbc-remove-unixodbc/0048-odbc32-Implement-SQLFreeHandle.patch b/patches/odbc-remove-unixodbc/0048-odbc32-Implement-SQLFreeHandle.patch new file mode 100644 index 00000000..eca4f92f --- /dev/null +++ b/patches/odbc-remove-unixodbc/0048-odbc32-Implement-SQLFreeHandle.patch @@ -0,0 +1,64 @@ +From f7460292e7db5cc684ab8a59d90b7bd30a0ddf02 Mon Sep 17 00:00:00 2001 +From: Steve Fawcett +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 +