wine-staging/patches/odbc-remove-unixodbc/0011-odbc32-Foward-SQLSetConnectAttr-requets-onto-the-dri.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

92 lines
3.3 KiB
Diff

From 7db07cc12c6e62ab86b429d0c0b0f88426ddb681 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Mon, 6 Feb 2023 08:55:12 +1100
Subject: [PATCH] odbc32: Foward SQLSetConnectAttr requets onto the driver
---
dlls/odbc32/proxyodbc.c | 49 ++++++++++++++++++++++++++++++++++++-----
1 file changed, 44 insertions(+), 5 deletions(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
index 50083a23e25..f817b3b524c 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -1043,11 +1043,40 @@ SQLRETURN WINAPI SQLRowCount(SQLHSTMT StatementHandle, SQLLEN *RowCount)
SQLRETURN WINAPI SQLSetConnectAttr(SQLHDBC ConnectionHandle, SQLINTEGER Attribute, SQLPOINTER Value,
SQLINTEGER StringLength)
{
- SQLRETURN ret = SQL_ERROR;
+ struct SQLHDBC_data *hdbc = ConnectionHandle;
+ SQLRETURN ret = SQL_SUCCESS;
- FIXME("(ConnectionHandle %p, Attribute %d, Value %p, StringLength %d)\n", ConnectionHandle, Attribute, Value,
+ TRACE("(ConnectionHandle %p, Attribute %d, Value %p, StringLength %d)\n", ConnectionHandle, Attribute, Value,
StringLength);
+ if (hdbc->type != SQL_HANDLE_DBC)
+ {
+ WARN("Wrong handle type %d\n", hdbc->type);
+ return SQL_ERROR;
+ }
+
+ switch(Attribute)
+ {
+ case SQL_ATTR_LOGIN_TIMEOUT:
+ if (Value)
+ hdbc->login_timeout = (intptr_t)Value;
+ else
+ hdbc->login_timeout = 0;
+ break;
+ default:
+ if (hdbc->pSQLSetConnectAttr)
+ ret = hdbc->pSQLSetConnectAttr(hdbc->driver_hdbc, Attribute, Value, StringLength);
+ else if(hdbc->pSQLSetConnectOption)
+ ret = hdbc->pSQLSetConnectOption(hdbc->driver_hdbc, Attribute, (SQLULEN)Value);
+ else
+ {
+ FIXME("Unsupported Attribute %d\n", Attribute);
+ ret = SQL_ERROR;
+ }
+ }
+
+ TRACE("ret %d\n", ret);
+
return ret;
}
@@ -1803,6 +1832,7 @@ SQLRETURN WINAPI SQLSetConnectAttrW(SQLHDBC ConnectionHandle, SQLINTEGER Attribu
SQLINTEGER StringLength)
{
struct SQLHDBC_data *hdbc = ConnectionHandle;
+ SQLRETURN ret = SQL_SUCCESS;
TRACE("(ConnectionHandle %p, Attribute %d, Value %p, StringLength %d)\n", ConnectionHandle, Attribute, Value,
StringLength);
@@ -1822,11 +1852,20 @@ SQLRETURN WINAPI SQLSetConnectAttrW(SQLHDBC ConnectionHandle, SQLINTEGER Attribu
hdbc->login_timeout = 0;
break;
default:
- FIXME("Unhandle attribute %d\n", Attribute);
- return SQL_ERROR;
+ if (hdbc->pSQLSetConnectAttrW)
+ ret = hdbc->pSQLSetConnectAttrW(hdbc->driver_hdbc, Attribute, Value, StringLength);
+ else if(hdbc->pSQLSetConnectOptionW)
+ ret = hdbc->pSQLSetConnectOptionW(hdbc->driver_hdbc, Attribute, (SQLULEN)Value);
+ else
+ {
+ FIXME("Unsupported Attribute %d\n", Attribute);
+ ret = SQL_ERROR;
+ }
}
- return SQL_SUCCESS;
+ TRACE("ret %d\n", ret);
+
+ return ret;
}
/*************************************************************************
--
2.43.0