From a7f29f123650f949aec93e3286be2f9a70df9846 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Sat, 10 Aug 2024 14:30:14 +1000 Subject: [PATCH] Rebase against 9c69ccf8ef2995548ef5fee9d0b68f68dec5dd62. Added two patches to fix upstream regression with ODBC32. --- ...reeing-SQL-handles-for-ODBC-v2-drive.patch | 68 +++----------- ...tEnvAttr-isnt-supported-in-ODBC-v2.0.patch | 10 +-- ...llocating-SQL-handles-for-ODBC-v2-dr.patch | 88 ++++++------------- ...-Support-Driver-in-connection-string.patch | 28 +++--- ...AttributeW-support-fallback-function.patch | 10 +-- ...ndParameter-handle-fallback-function.patch | 69 +++++++-------- ...nnectAttr-W-handle-fallback-function.patch | 52 ++++------- ...dles-when-requesting-information-of-.patch | 6 +- ...cFieldW-pass-correct-handle-onto-dri.patch | 19 ++-- ...-odbc32-SQLGetData-support-ODBC-v2.0.patch | 41 +++++---- ...tAttrW-support-fallback-for-ODBC-v2..patch | 39 ++++---- ...locHandle-to-allocated-a-STMT-handle.patch | 38 ++++++++ ...c32-Call-drivers-SQLBindCol-function.patch | 25 ++++++ staging/upstream-commit | 2 +- 14 files changed, 230 insertions(+), 265 deletions(-) create mode 100644 patches/odbc32-fixes/0017-odbc32-Use-SQLAllocHandle-to-allocated-a-STMT-handle.patch create mode 100644 patches/odbc32-fixes/0018-odbc32-Call-drivers-SQLBindCol-function.patch diff --git a/patches/odbc32-fixes/0001-odbc32-Support-freeing-SQL-handles-for-ODBC-v2-drive.patch b/patches/odbc32-fixes/0001-odbc32-Support-freeing-SQL-handles-for-ODBC-v2-drive.patch index cfac3091..2b2f7772 100644 --- a/patches/odbc32-fixes/0001-odbc32-Support-freeing-SQL-handles-for-ODBC-v2-drive.patch +++ b/patches/odbc32-fixes/0001-odbc32-Support-freeing-SQL-handles-for-ODBC-v2-drive.patch @@ -1,82 +1,42 @@ -From 56d18e7bd712c917f91e837918491def4b0f587d Mon Sep 17 00:00:00 2001 +From 49adfd79f730714b11c4d5f983ced05b26ffa52a Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Fri, 12 Jul 2024 13:42:26 +1000 -Subject: [PATCH 01/15] odbc32: Support freeing SQL handles for ODBC v2 - drivers. +Subject: [PATCH] odbc32: Support freeing SQL handles for ODBC v2 drivers. --- - dlls/odbc32/proxyodbc.c | 37 ++++++++++++++++++++++++++++++++++--- - 1 file changed, 34 insertions(+), 3 deletions(-) + dlls/odbc32/proxyodbc.c | 19 +++++++++++++++++++ + 1 file changed, 19 insertions(+) diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index b71ef7aac42..2a38197b243 100644 +index 4799ca0a11e..678d9260fbb 100644 --- a/dlls/odbc32/proxyodbc.c +++ b/dlls/odbc32/proxyodbc.c -@@ -1401,6 +1401,37 @@ SQLRETURN WINAPI SQLFetchScroll(SQLHSTMT StatementHandle, SQLSMALLINT FetchOrien - return ret; - } - -+static SQLRETURN freehandle_win32(struct handle *handle, SQLSMALLINT type, SQLUSMALLINT option) -+{ -+ SQLRETURN ret = SQL_ERROR; -+ -+ if (handle->win32_funcs->SQLFreeHandle) -+ { -+ ret = handle->win32_funcs->SQLFreeHandle( type, handle->win32_handle ); -+ } +@@ -1867,6 +1867,25 @@ static SQLRETURN free_handle_win32( SQLSMALLINT type, struct handle *handle ) + { + if (handle->win32_funcs->SQLFreeHandle) + return handle->win32_funcs->SQLFreeHandle( type, handle->win32_handle ); + else + { + /* ODBC v2 */ + if (type == SQL_HANDLE_ENV) + { + if (handle->win32_funcs->SQLFreeEnv) -+ ret = handle->win32_funcs->SQLFreeEnv( handle->win32_handle ); ++ return handle->win32_funcs->SQLFreeEnv( handle->win32_handle ); + } + else if (type == SQL_HANDLE_DBC) + { + if (handle->win32_funcs->SQLFreeConnect) -+ ret = handle->win32_funcs->SQLFreeConnect( handle->win32_handle ); ++ return handle->win32_funcs->SQLFreeConnect( handle->win32_handle ); + } + else if (type == SQL_HANDLE_STMT) + { + if (handle->win32_funcs->SQLFreeStmt) -+ ret = handle->win32_funcs->SQLFreeStmt( handle->win32_handle, option ); ++ return handle->win32_funcs->SQLFreeStmt( handle->win32_handle, SQL_CLOSE ); + } + } -+ -+ return ret; -+} -+ - /************************************************************************* - * SQLFreeConnect [ODBC32.014] - */ -@@ -1420,7 +1451,7 @@ SQLRETURN WINAPI SQLFreeConnect(SQLHDBC ConnectionHandle) - } - else if (handle->win32_handle) - { -- ret = handle->win32_funcs->SQLFreeHandle( SQL_HANDLE_DBC, handle->win32_handle ); -+ ret = freehandle_win32( handle, SQL_HANDLE_DBC, 0 ); - } + return SQL_ERROR; + } - free( handle ); -@@ -1447,7 +1478,7 @@ SQLRETURN WINAPI SQLFreeEnv(SQLHENV EnvironmentHandle) - } - else if (handle->win32_handle) - { -- ret = handle->win32_funcs->SQLFreeHandle( SQL_HANDLE_ENV, handle->win32_handle ); -+ ret = freehandle_win32( handle, SQL_HANDLE_ENV, 0 ); - } - - RegCloseKey( handle->drivers_key ); -@@ -1497,7 +1528,7 @@ SQLRETURN WINAPI SQLFreeHandle(SQLSMALLINT HandleType, SQLHANDLE Handle) - } - else if (handle->win32_handle) - { -- ret = handle->win32_funcs->SQLFreeHandle( HandleType, handle->win32_handle ); -+ ret = freehandle_win32( handle, HandleType, 0 ); - } - - RegCloseKey( handle->drivers_key ); -- 2.43.0 diff --git a/patches/odbc32-fixes/0002-odbc32-SQLSetEnvAttr-isnt-supported-in-ODBC-v2.0.patch b/patches/odbc32-fixes/0002-odbc32-SQLSetEnvAttr-isnt-supported-in-ODBC-v2.0.patch index c1727c14..9dfdd3c1 100644 --- a/patches/odbc32-fixes/0002-odbc32-SQLSetEnvAttr-isnt-supported-in-ODBC-v2.0.patch +++ b/patches/odbc32-fixes/0002-odbc32-SQLSetEnvAttr-isnt-supported-in-ODBC-v2.0.patch @@ -1,17 +1,17 @@ -From dc6b1e2572c7210ece06a3a9665738d3f811b4ba Mon Sep 17 00:00:00 2001 +From 1966db0e2fe8ee752a7a59b970749235b3fa0e20 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Thu, 18 Jul 2024 14:17:44 +1000 -Subject: [PATCH 02/15] odbc32: SQLSetEnvAttr isnt supported in ODBC v2.0 +Subject: [PATCH] odbc32: SQLSetEnvAttr isnt supported in ODBC v2.0 --- dlls/odbc32/proxyodbc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index 2a38197b243..741555f6582 100644 +index 6e51693e33c..0703e2f580d 100644 --- a/dlls/odbc32/proxyodbc.c +++ b/dlls/odbc32/proxyodbc.c -@@ -839,7 +839,7 @@ static int has_suffix( const WCHAR *str, const WCHAR *suffix ) +@@ -1010,7 +1010,7 @@ static int has_suffix( const WCHAR *str, const WCHAR *suffix ) static SQLRETURN set_env_attr( struct handle *handle, SQLINTEGER attr, SQLPOINTER value, SQLINTEGER len ) { @@ -20,7 +20,7 @@ index 2a38197b243..741555f6582 100644 if (handle->unix_handle) { -@@ -848,7 +848,8 @@ static SQLRETURN set_env_attr( struct handle *handle, SQLINTEGER attr, SQLPOINTE +@@ -1019,7 +1019,8 @@ static SQLRETURN set_env_attr( struct handle *handle, SQLINTEGER attr, SQLPOINTE } else if (handle->win32_handle) { diff --git a/patches/odbc32-fixes/0003-odbc32-Support-Allocating-SQL-handles-for-ODBC-v2-dr.patch b/patches/odbc32-fixes/0003-odbc32-Support-Allocating-SQL-handles-for-ODBC-v2-dr.patch index 0750c9bc..5e88ff18 100644 --- a/patches/odbc32-fixes/0003-odbc32-Support-Allocating-SQL-handles-for-ODBC-v2-dr.patch +++ b/patches/odbc32-fixes/0003-odbc32-Support-Allocating-SQL-handles-for-ODBC-v2-dr.patch @@ -1,98 +1,68 @@ -From de93b39154c4d964036d4fac9854bb4593a894a0 Mon Sep 17 00:00:00 2001 +From c6edaf28df9e495ff173910c6e0124d244784f41 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Thu, 18 Jul 2024 14:34:49 +1000 -Subject: [PATCH 03/15] odbc32: Support Allocating SQL handles for ODBC v2 - drivers. +Subject: [PATCH] odbc32: Support Allocating SQL handles for ODBC v2 drivers. --- - dlls/odbc32/proxyodbc.c | 42 ++++++++++++++++++++++++++++++++++++----- - 1 file changed, 37 insertions(+), 5 deletions(-) + 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 741555f6582..e8e08fb7d00 100644 +index 6fe38e7a863..6168786084d 100644 --- a/dlls/odbc32/proxyodbc.c +++ b/dlls/odbc32/proxyodbc.c -@@ -410,6 +410,38 @@ SQLRETURN WINAPI SQLAllocEnv(SQLHENV *EnvironmentHandle) - return ret; - } +@@ -439,13 +439,32 @@ static SQLRETURN alloc_handle_unix( SQLSMALLINT type, struct handle *input, stru -+static SQLRETURN allochandle_win32(struct handle *handle, SQLSMALLINT type, SQLHANDLE InputHandle, SQLHANDLE *OutputHandle) -+{ + static SQLRETURN alloc_handle_win32( SQLSMALLINT type, struct handle *input, struct handle *output ) + { + SQLRETURN ret = SQL_ERROR; -+ -+ if (handle->win32_funcs->SQLAllocHandle) -+ { -+ if ((ret = handle->win32_funcs->SQLAllocHandle( type, InputHandle, OutputHandle ))) -+ return ret; -+ } + if (input->win32_funcs->SQLAllocHandle) + { +- SQLRETURN ret = input->win32_funcs->SQLAllocHandle( type, input->win32_handle, &output->win32_handle ); +- if (SUCCESS( ret )) output->win32_funcs = input->win32_funcs; +- return ret; ++ ret = input->win32_funcs->SQLAllocHandle( type, input->win32_handle, &output->win32_handle ); + } +- return SQL_ERROR; + else + { + /* ODBC v2 */ + if (type == SQL_HANDLE_ENV) + { -+ if (handle->win32_funcs->SQLAllocEnv) -+ ret = handle->win32_funcs->SQLAllocEnv( OutputHandle ); ++ if (input->win32_funcs->SQLAllocEnv) ++ ret = input->win32_funcs->SQLAllocEnv( &output->win32_handle ); + } + else if (type == SQL_HANDLE_DBC) + { -+ if (handle->win32_funcs->SQLAllocConnect) -+ ret = handle->win32_funcs->SQLAllocConnect( InputHandle, OutputHandle ); ++ if (input->win32_funcs->SQLAllocConnect) ++ ret = input->win32_funcs->SQLAllocConnect( input, &output->win32_handle ); + } + else if (type == SQL_HANDLE_STMT) + { -+ if (handle->win32_funcs->SQLAllocStmt) -+ ret = handle->win32_funcs->SQLAllocStmt( InputHandle, OutputHandle ); ++ if (input->win32_funcs->SQLAllocStmt) ++ ret = input->win32_funcs->SQLAllocStmt( input, &output->win32_handle ); + } + } -+ ++ if (SUCCESS( ret )) output->win32_funcs = input->win32_funcs; + return ret; -+} -+ + } + /************************************************************************* - * SQLAllocHandle [ODBC32.024] - */ -@@ -438,7 +470,7 @@ SQLRETURN WINAPI SQLAllocHandle(SQLSMALLINT HandleType, SQLHANDLE InputHandle, S - } - else if (input->win32_handle) - { -- ret = input->win32_funcs->SQLAllocHandle( HandleType, input->win32_handle, &output->win32_handle ); -+ ret = allochandle_win32(input, HandleType, input->win32_handle, &output->win32_handle); - if (SUCCESS( ret )) output->win32_funcs = input->win32_funcs; - } - -@@ -469,7 +501,7 @@ SQLRETURN WINAPI SQLAllocStmt(SQLHDBC ConnectionHandle, SQLHSTMT *StatementHandl - } - else if (con->win32_handle) - { -- ret = con->win32_funcs->SQLAllocStmt( con->win32_handle, &stmt->win32_handle ); -+ ret = allochandle_win32(con, SQL_HANDLE_STMT, con->win32_handle, &stmt->win32_handle ); - if (SUCCESS( ret )) stmt->win32_funcs = con->win32_funcs; - } - -@@ -508,7 +540,7 @@ SQLRETURN WINAPI SQLAllocHandleStd(SQLSMALLINT HandleType, SQLHANDLE InputHandle - } - else if (input->win32_handle) - { -- ret = input->win32_funcs->SQLAllocHandleStd( HandleType, input->win32_handle, &output->win32_handle ); -+ ret = allochandle_win32(input, HandleType, input->win32_handle, &output->win32_handle); - if (SUCCESS( ret )) output->win32_funcs = input->win32_funcs; - } - -@@ -874,7 +906,7 @@ static SQLRETURN create_env( struct handle *handle, BOOL is_unix ) +@@ -1045,7 +1064,7 @@ static SQLRETURN create_env( struct handle *handle, BOOL is_unix ) } else { - if ((ret = handle->win32_funcs->SQLAllocHandle( SQL_HANDLE_ENV, NULL, &handle->win32_handle ))) return ret; -+ if ((ret = allochandle_win32(handle, SQL_HANDLE_ENV, NULL, &handle->win32_handle ))) return ret; ++ if ((ret = alloc_handle_win32(SQL_HANDLE_ENV, handle, handle ))) return ret; } return prepare_env( handle ); -@@ -930,7 +962,7 @@ static SQLRETURN create_con( struct handle *handle ) +@@ -1101,7 +1120,7 @@ static SQLRETURN create_con( struct handle *handle ) } else { - if ((ret = handle->win32_funcs->SQLAllocHandle( SQL_HANDLE_DBC, parent->win32_handle, &handle->win32_handle ))) -+ if ((ret = allochandle_win32(handle, SQL_HANDLE_DBC, parent->win32_handle, &handle->win32_handle ))) ++ if ((ret = alloc_handle_win32(SQL_HANDLE_DBC, parent, handle ))) return ret; } diff --git a/patches/odbc32-fixes/0004-odbc32-Support-Driver-in-connection-string.patch b/patches/odbc32-fixes/0004-odbc32-Support-Driver-in-connection-string.patch index 27d1cac5..d0711afa 100644 --- a/patches/odbc32-fixes/0004-odbc32-Support-Driver-in-connection-string.patch +++ b/patches/odbc32-fixes/0004-odbc32-Support-Driver-in-connection-string.patch @@ -1,4 +1,4 @@ -From 9eb47396d1a2f5a9a5fe275a92a75ae6a1bbabec Mon Sep 17 00:00:00 2001 +From 652327cf649f9d10794f18d6c3a2c3452f42f947 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Fri, 12 Jul 2024 14:13:33 +1000 Subject: [PATCH] odbc32: Support Driver in connection string @@ -8,10 +8,10 @@ Subject: [PATCH] odbc32: Support Driver in connection string 1 file changed, 75 insertions(+), 25 deletions(-) diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index 54e0800128e..7c00cece863 100644 +index 94504a8cc26..df8fa06dc57 100644 --- a/dlls/odbc32/proxyodbc.c +++ b/dlls/odbc32/proxyodbc.c -@@ -900,23 +900,28 @@ static HKEY open_odbcinst_key( void ) +@@ -989,23 +989,28 @@ static HKEY open_odbcinst_key( void ) return NULL; } @@ -47,7 +47,7 @@ index 54e0800128e..7c00cece863 100644 if (!(key_odbcinst = open_odbcinst_key()) || RegOpenKeyExW( key_odbcinst, driver_name, 0, KEY_READ, &key_driver )) { -@@ -1086,7 +1091,7 @@ SQLRETURN WINAPI SQLConnect(SQLHDBC ConnectionHandle, SQLCHAR *ServerName, SQLSM +@@ -1175,7 +1180,7 @@ SQLRETURN WINAPI SQLConnect(SQLHDBC ConnectionHandle, SQLCHAR *ServerName, SQLSM if (!handle) return SQL_INVALID_HANDLE; @@ -56,7 +56,7 @@ index 54e0800128e..7c00cece863 100644 { WARN( "can't find driver filename\n" ); goto done; -@@ -2984,6 +2989,35 @@ static SQLRETURN browse_connect_unix_a( struct handle *handle, SQLCHAR *in_conn_ +@@ -3983,6 +3988,35 @@ static SQLRETURN browse_connect_unix_a( struct handle *handle, SQLCHAR *in_conn_ return ODBC_CALL( SQLBrowseConnect, ¶ms ); } @@ -92,7 +92,7 @@ index 54e0800128e..7c00cece863 100644 /************************************************************************* * SQLBrowseConnect [ODBC32.055] */ -@@ -2993,6 +3027,7 @@ SQLRETURN WINAPI SQLBrowseConnect(SQLHDBC ConnectionHandle, SQLCHAR *InConnectio +@@ -3992,6 +4026,7 @@ SQLRETURN WINAPI SQLBrowseConnect(SQLHDBC ConnectionHandle, SQLCHAR *InConnectio struct handle *handle = ConnectionHandle; WCHAR *datasource = NULL, *filename = NULL, *connection_string = strdupAW( (const char *)InConnectionString ); SQLRETURN ret = SQL_ERROR; @@ -100,7 +100,7 @@ index 54e0800128e..7c00cece863 100644 TRACE("(ConnectionHandle %p, InConnectionString %s, StringLength1 %d, OutConnectionString %p, BufferLength, %d, " "StringLength2 %p)\n", ConnectionHandle, debugstr_sqlstr(InConnectionString, StringLength1), -@@ -3000,13 +3035,16 @@ SQLRETURN WINAPI SQLBrowseConnect(SQLHDBC ConnectionHandle, SQLCHAR *InConnectio +@@ -3999,13 +4034,16 @@ SQLRETURN WINAPI SQLBrowseConnect(SQLHDBC ConnectionHandle, SQLCHAR *InConnectio if (!handle) return SQL_INVALID_HANDLE; @@ -121,7 +121,7 @@ index 54e0800128e..7c00cece863 100644 { WARN( "can't find driver filename\n" ); goto done; -@@ -3809,6 +3847,7 @@ SQLRETURN WINAPI SQLDriverConnect(SQLHDBC ConnectionHandle, SQLHWND WindowHandle +@@ -5083,6 +5121,7 @@ SQLRETURN WINAPI SQLDriverConnect(SQLHDBC ConnectionHandle, SQLHWND WindowHandle struct handle *handle = ConnectionHandle; WCHAR *datasource = NULL, *filename = NULL, *connection_string = strdupAW( (const char *)InConnectionString ); SQLRETURN ret = SQL_ERROR; @@ -129,7 +129,7 @@ index 54e0800128e..7c00cece863 100644 TRACE("(ConnectionHandle %p, WindowHandle %p, InConnectionString %s, Length %d, OutConnectionString %p," " BufferLength %d, Length2 %p, DriverCompletion %d)\n", ConnectionHandle, WindowHandle, -@@ -3817,13 +3856,16 @@ SQLRETURN WINAPI SQLDriverConnect(SQLHDBC ConnectionHandle, SQLHWND WindowHandle +@@ -5091,13 +5130,16 @@ SQLRETURN WINAPI SQLDriverConnect(SQLHDBC ConnectionHandle, SQLHWND WindowHandle if (!handle) return SQL_INVALID_HANDLE; @@ -150,7 +150,7 @@ index 54e0800128e..7c00cece863 100644 { WARN( "can't find driver filename\n" ); goto done; -@@ -4022,7 +4064,7 @@ SQLRETURN WINAPI SQLConnectW(SQLHDBC ConnectionHandle, WCHAR *ServerName, SQLSMA +@@ -5310,7 +5352,7 @@ SQLRETURN WINAPI SQLConnectW(SQLHDBC ConnectionHandle, SQLWCHAR *ServerName, SQL if (!handle) return SQL_INVALID_HANDLE; @@ -159,7 +159,7 @@ index 54e0800128e..7c00cece863 100644 { WARN( "can't find driver filename\n" ); goto done; -@@ -4714,6 +4756,7 @@ SQLRETURN WINAPI SQLDriverConnectW(SQLHDBC ConnectionHandle, SQLHWND WindowHandl +@@ -6137,6 +6179,7 @@ SQLRETURN WINAPI SQLDriverConnectW(SQLHDBC ConnectionHandle, SQLHWND WindowHandl struct handle *handle = ConnectionHandle; WCHAR *datasource, *filename = NULL; SQLRETURN ret = SQL_ERROR; @@ -167,7 +167,7 @@ index 54e0800128e..7c00cece863 100644 TRACE("(ConnectionHandle %p, WindowHandle %p, InConnectionString %s, Length %d, OutConnectionString %p," " BufferLength %d, Length2 %p, DriverCompletion %d)\n", ConnectionHandle, WindowHandle, -@@ -4722,13 +4765,16 @@ SQLRETURN WINAPI SQLDriverConnectW(SQLHDBC ConnectionHandle, SQLHWND WindowHandl +@@ -6145,13 +6188,16 @@ SQLRETURN WINAPI SQLDriverConnectW(SQLHDBC ConnectionHandle, SQLHWND WindowHandl if (!handle) return SQL_INVALID_HANDLE; @@ -188,7 +188,7 @@ index 54e0800128e..7c00cece863 100644 { WARN( "can't find driver filename\n" ); goto done; -@@ -5020,6 +5066,7 @@ SQLRETURN WINAPI SQLBrowseConnectW(SQLHDBC ConnectionHandle, SQLWCHAR *InConnect +@@ -6553,6 +6599,7 @@ SQLRETURN WINAPI SQLBrowseConnectW(SQLHDBC ConnectionHandle, SQLWCHAR *InConnect struct handle *handle = ConnectionHandle; WCHAR *datasource, *filename = NULL; SQLRETURN ret = SQL_ERROR; @@ -196,7 +196,7 @@ index 54e0800128e..7c00cece863 100644 TRACE("(ConnectionHandle %p, InConnectionString %s, StringLength1 %d, OutConnectionString %p, BufferLength %d, " "StringLength2 %p)\n", ConnectionHandle, debugstr_sqlwstr(InConnectionString, StringLength1), StringLength1, -@@ -5027,13 +5074,16 @@ SQLRETURN WINAPI SQLBrowseConnectW(SQLHDBC ConnectionHandle, SQLWCHAR *InConnect +@@ -6560,13 +6607,16 @@ SQLRETURN WINAPI SQLBrowseConnectW(SQLHDBC ConnectionHandle, SQLWCHAR *InConnect if (!handle) return SQL_INVALID_HANDLE; diff --git a/patches/odbc32-fixes/0005-odbc32-SQLColAttributeW-support-fallback-function.patch b/patches/odbc32-fixes/0005-odbc32-SQLColAttributeW-support-fallback-function.patch index 08702a65..f96d0abf 100644 --- a/patches/odbc32-fixes/0005-odbc32-SQLColAttributeW-support-fallback-function.patch +++ b/patches/odbc32-fixes/0005-odbc32-SQLColAttributeW-support-fallback-function.patch @@ -1,17 +1,17 @@ -From c036cbda4e49b15e0a8dea55bb346929db5ce6c2 Mon Sep 17 00:00:00 2001 +From 6316f79675f38230ee43da7d8a993ff9cb1379f3 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Fri, 12 Jul 2024 14:19:22 +1000 -Subject: [PATCH 05/15] odbc32: SQLColAttributeW support fallback function +Subject: [PATCH] odbc32: SQLColAttributeW support fallback function --- dlls/odbc32/proxyodbc.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index 511fd8c9de3..1f51ac2a27e 100644 +index df8fa06dc57..cbe3e72ef35 100644 --- a/dlls/odbc32/proxyodbc.c +++ b/dlls/odbc32/proxyodbc.c -@@ -4060,6 +4060,21 @@ static SQLRETURN col_attribute_unix_w( struct handle *handle, SQLUSMALLINT col, +@@ -5686,6 +5686,21 @@ static SQLRETURN col_attribute_unix_w( struct handle *handle, SQLUSMALLINT col, return ret; } @@ -33,7 +33,7 @@ index 511fd8c9de3..1f51ac2a27e 100644 static SQLRETURN col_attribute_win32_w( struct handle *handle, SQLUSMALLINT col, SQLUSMALLINT field_id, SQLPOINTER char_attr, SQLSMALLINT buflen, SQLSMALLINT *retlen, SQLLEN *num_attr ) -@@ -4067,6 +4082,14 @@ static SQLRETURN col_attribute_win32_w( struct handle *handle, SQLUSMALLINT col, +@@ -5693,6 +5708,14 @@ static SQLRETURN col_attribute_win32_w( struct handle *handle, SQLUSMALLINT col, if (handle->win32_funcs->SQLColAttributeW) return handle->win32_funcs->SQLColAttributeW( handle->win32_handle, col, field_id, char_attr, buflen, retlen, num_attr ); diff --git a/patches/odbc32-fixes/0008-odbc32-SQLBindParameter-handle-fallback-function.patch b/patches/odbc32-fixes/0008-odbc32-SQLBindParameter-handle-fallback-function.patch index f098354e..d9468e71 100644 --- a/patches/odbc32-fixes/0008-odbc32-SQLBindParameter-handle-fallback-function.patch +++ b/patches/odbc32-fixes/0008-odbc32-SQLBindParameter-handle-fallback-function.patch @@ -1,52 +1,45 @@ -From d3e972d613def74c2b59757ca25653303cb652bf Mon Sep 17 00:00:00 2001 +From 83238653f67745cd9316b6140fc32a424ffa9b1b Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Fri, 12 Jul 2024 14:40:32 +1000 -Subject: [PATCH 08/15] odbc32: SQLBindParameter handle fallback function +Subject: [PATCH] odbc32: SQLBindParameter handle fallback function --- - dlls/odbc32/proxyodbc.c | 27 ++++++++++++++++++++++++++- - 1 file changed, 26 insertions(+), 1 deletion(-) + dlls/odbc32/proxyodbc.c | 22 ++++++++++++++++++++++ + 1 file changed, 22 insertions(+) diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index 6eb15687f92..462661f43de 100644 +index 557cd212425..7105f3534ce 100644 --- a/dlls/odbc32/proxyodbc.c +++ b/dlls/odbc32/proxyodbc.c -@@ -3570,9 +3570,34 @@ SQLRETURN WINAPI SQLBindParameter(SQLHSTMT StatementHandle, SQLUSMALLINT Paramet - } - else if (handle->win32_handle) - { -- ret = handle->win32_funcs->SQLBindParameter( handle->win32_handle, ParameterNumber, InputOutputType, ValueType, -+ if (handle->win32_funcs->SQLBindParameter) -+ { -+ ret = handle->win32_funcs->SQLBindParameter( handle->win32_handle, ParameterNumber, InputOutputType, ValueType, - ParameterType, ColumnSize, DecimalDigits, ParameterValue, - BufferLength, StrLen_or_Ind ); -+ } -+ else if(handle->win32_funcs->SQLBindParam) -+ { -+ /* ODBC v2 */ -+ /* TODO: Make function */ -+ if(ValueType == SQL_C_TYPE_TIME) -+ ValueType = SQL_C_TIME; -+ else if(ValueType == SQL_C_TYPE_DATE) -+ ValueType = SQL_C_DATE; -+ else if(ValueType == SQL_C_TYPE_TIMESTAMP) -+ ValueType = SQL_C_TIMESTAMP; +@@ -5052,6 +5052,28 @@ static SQLRETURN bind_parameter_win32( struct handle *handle, SQLUSMALLINT param + if (handle->win32_funcs->SQLBindParameter) + return handle->win32_funcs->SQLBindParameter( handle->win32_handle, param, io_type, value_type, param_type, + size, digits, value, buflen, len ); ++ else if(handle->win32_funcs->SQLBindParam) ++ { ++ /* ODBC v2 */ ++ /* TODO: Make function */ ++ if (value_type == SQL_C_TYPE_TIME) ++ value_type = SQL_C_TIME; ++ else if (value_type == SQL_C_TYPE_DATE) ++ value_type = SQL_C_DATE; ++ else if (value_type == SQL_C_TYPE_TIMESTAMP) ++ value_type = SQL_C_TIMESTAMP; + -+ /* TODO: Make function */ -+ if (ParameterType == SQL_TIME) -+ ParameterType = SQL_TYPE_TIME; -+ else if (ParameterType == SQL_DATE) -+ ParameterType = SQL_TYPE_DATE; -+ else if (ParameterType == SQL_TIMESTAMP) -+ ParameterType = SQL_TYPE_TIMESTAMP;;; ++ /* TODO: Make function */ ++ if (param_type == SQL_TIME) ++ param_type = SQL_TYPE_TIME; ++ else if (param_type == SQL_DATE) ++ param_type = SQL_TYPE_DATE; ++ else if (param_type == SQL_TIMESTAMP) ++ param_type = SQL_TYPE_TIMESTAMP;;; + -+ ret = handle->win32_funcs->SQLBindParam(handle->win32_handle, ParameterNumber, ValueType, ParameterType, -+ ColumnSize, DecimalDigits, ParameterValue, StrLen_or_Ind); -+ } - } ++ return handle->win32_funcs->SQLBindParam(handle->win32_handle, param, value_type, param_type, ++ size, digits, value, len); ++ } + return SQL_ERROR; + } - TRACE("Returning %d\n", ret); -- 2.43.0 diff --git a/patches/odbc32-fixes/0009-odbc32-SQLSetConnectAttr-W-handle-fallback-function.patch b/patches/odbc32-fixes/0009-odbc32-SQLSetConnectAttr-W-handle-fallback-function.patch index 33692bf9..17db58e0 100644 --- a/patches/odbc32-fixes/0009-odbc32-SQLSetConnectAttr-W-handle-fallback-function.patch +++ b/patches/odbc32-fixes/0009-odbc32-SQLSetConnectAttr-W-handle-fallback-function.patch @@ -1,46 +1,28 @@ -From 20bf2dea9241d387c9415d816ea96e1947d8a710 Mon Sep 17 00:00:00 2001 +From 20374d93364244b20dc9c87b53c40c375d4f1235 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Fri, 12 Jul 2024 14:55:47 +1000 -Subject: [PATCH 09/15] odbc32: SQLSetConnectAttr/W handle fallback function +Subject: [PATCH] odbc32: SQLSetConnectAttr/W handle fallback function --- - dlls/odbc32/proxyodbc.c | 16 ++++++++++++++-- - 1 file changed, 14 insertions(+), 2 deletions(-) + dlls/odbc32/proxyodbc.c | 5 +++++ + 1 file changed, 5 insertions(+) diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index 462661f43de..e24557fbb11 100644 +index 7105f3534ce..dd94e070796 100644 --- a/dlls/odbc32/proxyodbc.c +++ b/dlls/odbc32/proxyodbc.c -@@ -2301,7 +2301,13 @@ SQLRETURN WINAPI SQLSetConnectAttr(SQLHDBC ConnectionHandle, SQLINTEGER Attribut - } - else if (handle->win32_handle) - { -- ret = handle->win32_funcs->SQLSetConnectAttr( handle->win32_handle, Attribute, Value, StringLength ); -+ if(handle->win32_funcs->SQLSetConnectOption) -+ ret = handle->win32_funcs->SQLSetConnectAttr( handle->win32_handle, Attribute, Value, StringLength ); -+ else if(handle->win32_funcs->SQLSetConnectOption) -+ { -+ /* ODBC v2 */ -+ ret = handle->win32_funcs->SQLSetConnectOption( handle->win32_handle, Attribute, (SQLULEN)Value ); -+ } - } - else - { -@@ -4429,7 +4435,13 @@ SQLRETURN WINAPI SQLSetConnectAttrW(SQLHDBC ConnectionHandle, SQLINTEGER Attribu - } - else if (handle->win32_handle) - { -- ret = handle->win32_funcs->SQLSetConnectAttrW( handle->win32_handle, Attribute, Value, StringLength ); -+ if (handle->win32_funcs->SQLSetConnectAttrW) -+ ret = handle->win32_funcs->SQLSetConnectAttrW( handle->win32_handle, Attribute, Value, StringLength ); -+ else if(handle->win32_funcs->SQLSetConnectOptionW) -+ { -+ /* ODBC v2 */ -+ ret = handle->win32_funcs->SQLSetConnectOptionW( handle->win32_handle, Attribute, (SQLULEN)Value ); -+ } - } - else - { +@@ -6123,6 +6123,11 @@ static SQLRETURN set_connect_attr_win32_w( struct handle *handle, SQLINTEGER att + if (handle->win32_funcs->SQLSetConnectAttrW) + return handle->win32_funcs->SQLSetConnectAttrW( handle->win32_handle, attr, value, len ); + if (handle->win32_funcs->SQLSetConnectAttr) FIXME( "Unicode to ANSI conversion not handled\n" ); ++ else if(handle->win32_funcs->SQLSetConnectOptionW) ++ { ++ /* ODBC v2 */ ++ return handle->win32_funcs->SQLSetConnectOptionW( handle->win32_handle, attr, (SQLULEN)value ); ++ } + return SQL_ERROR; + } + -- 2.43.0 diff --git a/patches/odbc32-fixes/0010-odbc32-Store-handles-when-requesting-information-of-.patch b/patches/odbc32-fixes/0010-odbc32-Store-handles-when-requesting-information-of-.patch index 494f6c49..4eca2b78 100644 --- a/patches/odbc32-fixes/0010-odbc32-Store-handles-when-requesting-information-of-.patch +++ b/patches/odbc32-fixes/0010-odbc32-Store-handles-when-requesting-information-of-.patch @@ -1,4 +1,4 @@ -From 2ea91088f723c630f2bc4ac2117adb175d535f1a Mon Sep 17 00:00:00 2001 +From d92d2f9dab7aa9552dbed099a3f07182c8bad185 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Wed, 10 Jul 2024 15:17:00 +1000 Subject: [PATCH] odbc32: Store handles when requesting information of Columns. @@ -9,10 +9,10 @@ Subject: [PATCH] odbc32: Store handles when requesting information of Columns. 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index 8233f77b418..53d0ba4f127 100644 +index dd94e070796..7120f24b76b 100644 --- a/dlls/odbc32/proxyodbc.c +++ b/dlls/odbc32/proxyodbc.c -@@ -5298,7 +5298,39 @@ SQLRETURN WINAPI SQLGetStmtAttrW(SQLHSTMT StatementHandle, SQLINTEGER Attribute, +@@ -6105,7 +6105,39 @@ SQLRETURN WINAPI SQLGetStmtAttrW(SQLHSTMT StatementHandle, SQLINTEGER Attribute, } else if (handle->win32_handle) { diff --git a/patches/odbc32-fixes/0011-odbc32-SQLSetDescFieldW-pass-correct-handle-onto-dri.patch b/patches/odbc32-fixes/0011-odbc32-SQLSetDescFieldW-pass-correct-handle-onto-dri.patch index 627e7ec4..293782f0 100644 --- a/patches/odbc32-fixes/0011-odbc32-SQLSetDescFieldW-pass-correct-handle-onto-dri.patch +++ b/patches/odbc32-fixes/0011-odbc32-SQLSetDescFieldW-pass-correct-handle-onto-dri.patch @@ -1,18 +1,17 @@ -From 8c26d09014cdf26756bd808e2c076d9d10f6295f Mon Sep 17 00:00:00 2001 +From cee76bad632261533d15e6d642367fbb66176564 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Sat, 13 Jul 2024 15:23:10 +1000 -Subject: [PATCH 11/15] odbc32: SQLSetDescFieldW pass correct handle onto - driver +Subject: [PATCH] odbc32: SQLSetDescFieldW pass correct handle onto driver --- dlls/odbc32/proxyodbc.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index 3a9c2802d45..c70b0d80012 100644 +index 7120f24b76b..ddf6c0ac9f5 100644 --- a/dlls/odbc32/proxyodbc.c +++ b/dlls/odbc32/proxyodbc.c -@@ -4387,7 +4387,7 @@ SQLRETURN WINAPI SQLGetStmtAttrW(SQLHSTMT StatementHandle, SQLINTEGER Attribute, +@@ -6086,7 +6086,7 @@ SQLRETURN WINAPI SQLGetStmtAttrW(SQLHSTMT StatementHandle, SQLINTEGER Attribute, SQLINTEGER BufferLength, SQLINTEGER *StringLength) { struct handle *handle = StatementHandle; @@ -21,7 +20,7 @@ index 3a9c2802d45..c70b0d80012 100644 TRACE("(StatementHandle %p, Attribute %d, Value %p, BufferLength %d, StringLength %p)\n", StatementHandle, Attribute, Value, BufferLength, StringLength); -@@ -5299,7 +5299,8 @@ done: +@@ -7268,7 +7268,8 @@ static SQLRETURN set_desc_field_win32_w( struct handle *handle, SQLSMALLINT reco SQLRETURN WINAPI SQLSetDescFieldW(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier, SQLPOINTER Value, SQLINTEGER BufferLength) { @@ -31,19 +30,19 @@ index 3a9c2802d45..c70b0d80012 100644 SQLRETURN ret = SQL_ERROR; TRACE("(DescriptorHandle %p, RecNumber %d, FieldIdentifier %d, Value %p, BufferLength %d)\n", DescriptorHandle, -@@ -5315,7 +5316,11 @@ SQLRETURN WINAPI SQLSetDescFieldW(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumb +@@ -7282,7 +7283,11 @@ SQLRETURN WINAPI SQLSetDescFieldW(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumb } else if (handle->win32_handle) { -- ret = handle->win32_funcs->SQLSetDescFieldW( handle->win32_handle, RecNumber, FieldIdentifier, Value, +- ret = set_desc_field_win32_w( handle, RecNumber, FieldIdentifier, Value, BufferLength ); + if (handle->imp_param_desc.driver_hdesc) + ret = handle->win32_funcs->SQLSetDescFieldW( handle->imp_param_desc.driver_hdesc, RecNumber, FieldIdentifier, Value, + BufferLength ); + else -+ ret = handle->win32_funcs->SQLSetDescFieldW( handle->app_param_desc.driver_hdesc, RecNumber, FieldIdentifier, Value, - BufferLength ); ++ ret = set_desc_field_win32_w( handle, RecNumber, FieldIdentifier, Value, BufferLength ); } + TRACE("Returning %d\n", ret); -- 2.43.0 diff --git a/patches/odbc32-fixes/0013-odbc32-SQLGetData-support-ODBC-v2.0.patch b/patches/odbc32-fixes/0013-odbc32-SQLGetData-support-ODBC-v2.0.patch index 876a3753..6759da83 100644 --- a/patches/odbc32-fixes/0013-odbc32-SQLGetData-support-ODBC-v2.0.patch +++ b/patches/odbc32-fixes/0013-odbc32-SQLGetData-support-ODBC-v2.0.patch @@ -1,32 +1,37 @@ -From d83dcacabf0918cc4cdeb3d6358585d9178defa8 Mon Sep 17 00:00:00 2001 +From 37a034464df09450fe1d4226bf43ca7588c7894d Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Wed, 17 Jul 2024 21:55:20 +1000 -Subject: [PATCH 13/15] odbc32: SQLGetData support ODBC v2.0 +Subject: [PATCH] odbc32: SQLGetData support ODBC v2.0 --- - dlls/odbc32/proxyodbc.c | 9 +++++++++ - 1 file changed, 9 insertions(+) + dlls/odbc32/proxyodbc.c | 13 +++++++++++++ + 1 file changed, 13 insertions(+) diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index bb1cae25051..a66ec99b913 100644 +index be20e967aea..1836164796f 100644 --- a/dlls/odbc32/proxyodbc.c +++ b/dlls/odbc32/proxyodbc.c -@@ -1761,6 +1761,15 @@ SQLRETURN WINAPI SQLGetData(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber, - } - else if (handle->win32_handle) - { +@@ -2223,7 +2223,20 @@ static SQLRETURN get_data_win32( struct handle *handle, SQLUSMALLINT column, SQL + SQLLEN buflen, SQLLEN *retlen ) + { + if (handle->win32_funcs->SQLGetData) ++ { + if (handle->env_attr_version == SQL_OV_ODBC2) + { -+ if (TargetType == SQL_C_TYPE_TIME) -+ TargetType = SQL_C_TIME; -+ else if (TargetType == SQL_C_TYPE_DATE) -+ TargetType = SQL_C_DATE; -+ else if (TargetType == SQL_C_TYPE_TIMESTAMP) -+ TargetType = SQL_C_TIMESTAMP; ++ if (type == SQL_C_TYPE_TIME) ++ type = SQL_C_TIME; ++ else if (type == SQL_C_TYPE_DATE) ++ type = SQL_C_DATE; ++ else if (type == SQL_C_TYPE_TIMESTAMP) ++ type = SQL_C_TIMESTAMP; + } - ret = handle->win32_funcs->SQLGetData( handle->win32_handle, ColumnNumber, TargetType, TargetValue, - BufferLength, StrLen_or_Ind ); - } ++ + return handle->win32_funcs->SQLGetData( handle->win32_handle, column, type, value, buflen, retlen ); ++ } ++ + return SQL_ERROR; + } + -- 2.43.0 diff --git a/patches/odbc32-fixes/0015-odbc32-SQLSetStmtAttrW-support-fallback-for-ODBC-v2..patch b/patches/odbc32-fixes/0015-odbc32-SQLSetStmtAttrW-support-fallback-for-ODBC-v2..patch index 486569de..4351d9ec 100644 --- a/patches/odbc32-fixes/0015-odbc32-SQLSetStmtAttrW-support-fallback-for-ODBC-v2..patch +++ b/patches/odbc32-fixes/0015-odbc32-SQLSetStmtAttrW-support-fallback-for-ODBC-v2..patch @@ -1,35 +1,28 @@ -From 270c8b4b7f1d7cd91c035545cf223742874ed76a Mon Sep 17 00:00:00 2001 +From b86180b88e1d485bb628a195e2315be2bada2898 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Wed, 17 Jul 2024 22:04:39 +1000 -Subject: [PATCH 15/15] odbc32: SQLSetStmtAttrW support fallback for ODBC v2.0 +Subject: [PATCH] odbc32: SQLSetStmtAttrW support fallback for ODBC v2.0 --- - dlls/odbc32/proxyodbc.c | 12 +++++++++++- - 1 file changed, 11 insertions(+), 1 deletion(-) + dlls/odbc32/proxyodbc.c | 5 +++++ + 1 file changed, 5 insertions(+) diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index a9d23c94504..0de97b542d9 100644 +index 3429e8a26ce..2464ddfebee 100644 --- a/dlls/odbc32/proxyodbc.c +++ b/dlls/odbc32/proxyodbc.c -@@ -5387,7 +5387,17 @@ SQLRETURN WINAPI SQLSetStmtAttrW(SQLHSTMT StatementHandle, SQLINTEGER Attribute, - } - else if (handle->win32_handle) - { -- ret = handle->win32_funcs->SQLSetStmtAttrW( handle->win32_handle, Attribute, Value, StringLength ); -+ if(handle->win32_funcs->SQLSetStmtAttrW) -+ ret = handle->win32_funcs->SQLSetStmtAttrW( handle->win32_handle, Attribute, Value, StringLength ); -+ else -+ { -+ /* ODBC v2.0 */ -+ if (handle->win32_funcs->SQLSetStmtOption) -+ { -+ ret = handle->win32_funcs->SQLSetStmtOption( handle->win32_handle, Attribute, (SQLULEN)Value ); -+ } -+ } -+ - } +@@ -7350,6 +7350,11 @@ static SQLRETURN set_stmt_attr_win32_w( struct handle *handle, SQLINTEGER attr, + if (handle->win32_funcs->SQLSetStmtAttrW) + return handle->win32_funcs->SQLSetStmtAttrW( handle->win32_handle, attr, value, len ); + if (handle->win32_funcs->SQLSetStmtAttr) FIXME( "Unicode to ANSI conversion not handled\n" ); ++ else if (handle->win32_funcs->SQLSetStmtOption) ++ { ++ /* ODBC v2.0 */ ++ return handle->win32_funcs->SQLSetStmtOption( handle->win32_handle, attr, (SQLULEN)value ); ++ } + return SQL_ERROR; + } - TRACE("Returning %d\n", ret); -- 2.43.0 diff --git a/patches/odbc32-fixes/0017-odbc32-Use-SQLAllocHandle-to-allocated-a-STMT-handle.patch b/patches/odbc32-fixes/0017-odbc32-Use-SQLAllocHandle-to-allocated-a-STMT-handle.patch new file mode 100644 index 00000000..7d1d8094 --- /dev/null +++ b/patches/odbc32-fixes/0017-odbc32-Use-SQLAllocHandle-to-allocated-a-STMT-handle.patch @@ -0,0 +1,38 @@ +From 1d3f665c4081f2675864b98962b4d8a611564063 Mon Sep 17 00:00:00 2001 +From: Alistair Leslie-Hughes +Date: Sat, 10 Aug 2024 14:38:54 +1000 +Subject: [PATCH] odbc32: Use SQLAllocHandle to allocated a STMT handle + +--- + dlls/odbc32/proxyodbc.c | 13 +++++++++---- + 1 file changed, 9 insertions(+), 4 deletions(-) + +diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c +index 70837003b69..0fa0102f2bb 100644 +--- a/dlls/odbc32/proxyodbc.c ++++ b/dlls/odbc32/proxyodbc.c +@@ -515,12 +515,17 @@ static SQLRETURN alloc_stmt_unix( struct handle *con, struct handle *stmt ) + + static SQLRETURN alloc_stmt_win32( struct handle *con, struct handle *stmt ) + { +- if (con->win32_funcs->SQLAllocStmt) ++ SQLRETURN ret = SQL_ERROR; ++ if (con->win32_funcs->SQLAllocHandle) + { +- SQLRETURN ret = con->win32_funcs->SQLAllocStmt( con->win32_handle, &stmt->win32_handle ); +- if (SUCCESS( ret )) stmt->win32_funcs = con->win32_funcs; ++ ret = con->win32_funcs->SQLAllocHandle( SQL_HANDLE_STMT, con->win32_handle, &stmt->win32_handle ); + } +- return SQL_ERROR; ++ else if (con->win32_funcs->SQLAllocStmt) ++ { ++ ret = con->win32_funcs->SQLAllocStmt( con->win32_handle, &stmt->win32_handle ); ++ } ++ if (SUCCESS( ret )) stmt->win32_funcs = con->win32_funcs; ++ return ret; + } + + /************************************************************************* +-- +2.43.0 + diff --git a/patches/odbc32-fixes/0018-odbc32-Call-drivers-SQLBindCol-function.patch b/patches/odbc32-fixes/0018-odbc32-Call-drivers-SQLBindCol-function.patch new file mode 100644 index 00000000..aa1bf84b --- /dev/null +++ b/patches/odbc32-fixes/0018-odbc32-Call-drivers-SQLBindCol-function.patch @@ -0,0 +1,25 @@ +From 14b0cc45d3d19baf6c1f2534f8f31b7b5299c54f Mon Sep 17 00:00:00 2001 +From: Alistair Leslie-Hughes +Date: Sat, 10 Aug 2024 14:43:02 +1000 +Subject: [PATCH] odbc32: Call drivers SQLBindCol function + +--- + dlls/odbc32/proxyodbc.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c +index 0fa0102f2bb..35744622513 100644 +--- a/dlls/odbc32/proxyodbc.c ++++ b/dlls/odbc32/proxyodbc.c +@@ -664,7 +664,7 @@ static SQLRETURN bind_col_win32( struct handle *handle, SQLUSMALLINT column, SQL + SQLLEN buflen, SQLLEN *retlen ) + { + if (handle->win32_funcs->SQLBindCol) +- return SQLBindCol( handle->win32_handle, column, type, value, buflen, retlen ); ++ return handle->win32_funcs->SQLBindCol( handle->win32_handle, column, type, value, buflen, retlen ); + return SQL_ERROR; + } + +-- +2.43.0 + diff --git a/staging/upstream-commit b/staging/upstream-commit index a5595183..0cb0becb 100644 --- a/staging/upstream-commit +++ b/staging/upstream-commit @@ -1 +1 @@ -7df297968a932437c5ac50c67376f05265179cca +9c69ccf8ef2995548ef5fee9d0b68f68dec5dd62