From 827ccc5a0ef8a1b1e1290d7225f25619ca11fcf0 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes 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 e816caa0daa..00822d9d263 100644 --- a/dlls/odbc32/proxyodbc.c +++ b/dlls/odbc32/proxyodbc.c @@ -1042,11 +1042,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; } @@ -1802,6 +1831,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); @@ -1821,11 +1851,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