From 215e6efd27d5ae0a2bf4fc205972da3f319d70b2 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Thu, 18 Jul 2024 16:30:03 +1000 Subject: [PATCH] Updated odbc32-fixes patchset Reordered the Alloc/Free handle patches together. Fixed an issue with the Driver patchset (Thanks Daniel Lehman) --- ...SQLFreeHandle-handle-ODBC-v2-drivers.patch | 46 -------- ...reeing-SQL-handles-for-ODBC-v2-drive.patch | 82 ++++++++++++++ ...tEnvAttr-isnt-supported-in-ODBC-v2.0.patch | 35 ++++++ ...llocating-SQL-handles-for-ODBC-v2-dr.patch | 101 ++++++++++++++++++ ...Support-Driver-in-connection-string.patch} | 43 ++++---- ...ttributeW-support-fallback-function.patch} | 10 +- ...tDiagRec-W-handle-fallback-function.patch} | 10 +- ...d-function-pointer-for-SQLBindParam.patch} | 6 +- ...dParameter-handle-fallback-function.patch} | 8 +- ...nectAttr-W-handle-fallback-function.patch} | 10 +- ...les-when-requesting-information-of-.patch} | 9 +- ...FieldW-pass-correct-handle-onto-dri.patch} | 13 +-- ...loaded-driver-SQL_ATTR_ODBC_VERSION.patch} | 10 +- ...odbc32-SQLGetData-support-ODBC-v2.0.patch} | 8 +- ...-SQLColAttributesW-support-ODBC-v2.0.patch | 45 ++++++++ ...reating-Environment-handle-with-ODBC.patch | 83 -------------- ...llocHandle-use-fallback-for-ODBC-2.0.patch | 38 ------- ...AttrW-support-fallback-for-ODBC-v2..patch} | 8 +- ...-SQLColAttributesW-support-ODBC-v2.0.patch | 87 --------------- 19 files changed, 333 insertions(+), 319 deletions(-) delete mode 100644 patches/odbc32-fixes/0001-odbc32-SQLFreeHandle-handle-ODBC-v2-drivers.patch create mode 100644 patches/odbc32-fixes/0001-odbc32-Support-freeing-SQL-handles-for-ODBC-v2-drive.patch create mode 100644 patches/odbc32-fixes/0002-odbc32-SQLSetEnvAttr-isnt-supported-in-ODBC-v2.0.patch create mode 100644 patches/odbc32-fixes/0003-odbc32-Support-Allocating-SQL-handles-for-ODBC-v2-dr.patch rename patches/odbc32-fixes/{0002-odbc32-Support-Driver-in-connection-string.patch => 0004-odbc32-Support-Driver-in-connection-string.patch} (85%) rename patches/odbc32-fixes/{0003-odbc32-SQLColAttributeW-support-fallback-function.patch => 0005-odbc32-SQLColAttributeW-support-fallback-function.patch} (85%) rename patches/odbc32-fixes/{0005-odbc32-SQLGetDiagRec-W-handle-fallback-function.patch => 0006-odbc32-SQLGetDiagRec-W-handle-fallback-function.patch} (90%) rename patches/odbc32-fixes/{0006-odbc32-Load-function-pointer-for-SQLBindParam.patch => 0007-odbc32-Load-function-pointer-for-SQLBindParam.patch} (88%) rename patches/odbc32-fixes/{0007-odbc32-SQLBindParameter-handle-fallback-function.patch => 0008-odbc32-SQLBindParameter-handle-fallback-function.patch} (89%) rename patches/odbc32-fixes/{0008-odbc32-SQLSetConnectAttr-W-handle-fallback-function.patch => 0009-odbc32-SQLSetConnectAttr-W-handle-fallback-function.patch} (83%) rename patches/odbc32-fixes/{0011-odbc32-Store-handles-when-requesting-information-of-.patch => 0010-odbc32-Store-handles-when-requesting-information-of-.patch} (93%) rename patches/odbc32-fixes/{0012-odbc32-SQLSetDescFieldW-pass-correct-handle-onto-dri.patch => 0011-odbc32-SQLSetDescFieldW-pass-correct-handle-onto-dri.patch} (84%) rename patches/odbc32-fixes/{0016-odbc32-Record-loaded-driver-SQL_ATTR_ODBC_VERSION.patch => 0012-odbc32-Record-loaded-driver-SQL_ATTR_ODBC_VERSION.patch} (80%) rename patches/odbc32-fixes/{0017-odbc32-SQLGetData-support-ODBC-v2.0.patch => 0013-odbc32-SQLGetData-support-ODBC-v2.0.patch} (81%) create mode 100644 patches/odbc32-fixes/0014-odbc32-SQLColAttributesW-support-ODBC-v2.0.patch delete mode 100644 patches/odbc32-fixes/0014-odbc32-Support-Creating-Environment-handle-with-ODBC.patch delete mode 100644 patches/odbc32-fixes/0015-odbc32-SQLAllocHandle-use-fallback-for-ODBC-2.0.patch rename patches/odbc32-fixes/{0019-odbc32-SQLSetStmtAttrW-support-fallback-for-ODBC-v2..patch => 0015-odbc32-SQLSetStmtAttrW-support-fallback-for-ODBC-v2..patch} (80%) delete mode 100644 patches/odbc32-fixes/0018-odbc32-SQLColAttributesW-support-ODBC-v2.0.patch diff --git a/patches/odbc32-fixes/0001-odbc32-SQLFreeHandle-handle-ODBC-v2-drivers.patch b/patches/odbc32-fixes/0001-odbc32-SQLFreeHandle-handle-ODBC-v2-drivers.patch deleted file mode 100644 index 5954f5de..00000000 --- a/patches/odbc32-fixes/0001-odbc32-SQLFreeHandle-handle-ODBC-v2-drivers.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 45cc0ee874528258d34e21063cf514ccf40a9865 Mon Sep 17 00:00:00 2001 -From: Alistair Leslie-Hughes -Date: Fri, 12 Jul 2024 13:42:26 +1000 -Subject: [PATCH] odbc32: SQLFreeHandle handle ODBC v2 drivers - ---- - dlls/odbc32/proxyodbc.c | 23 ++++++++++++++++++++++- - 1 file changed, 22 insertions(+), 1 deletion(-) - -diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index 957584af008..9a4f08440ea 100644 ---- a/dlls/odbc32/proxyodbc.c -+++ b/dlls/odbc32/proxyodbc.c -@@ -1454,7 +1454,28 @@ SQLRETURN WINAPI SQLFreeHandle(SQLSMALLINT HandleType, SQLHANDLE Handle) - } - else if (handle->win32_handle) - { -- ret = handle->win32_funcs->SQLFreeHandle( HandleType, handle->win32_handle ); -+ if (handle->win32_funcs->SQLFreeHandle) -+ { -+ ret = handle->win32_funcs->SQLFreeHandle( HandleType, handle->win32_handle ); -+ } -+ else -+ { -+ /* ODBC v2 */ -+ if (HandleType == SQL_HANDLE_DBC) -+ { -+ if (handle->win32_funcs->SQLFreeConnect) -+ ret = handle->win32_funcs->SQLFreeConnect(handle->win32_handle); -+ else -+ ERR("Failed to free connection HANDLE\n"); -+ } -+ else if (HandleType == SQL_HANDLE_STMT) -+ { -+ if (handle->win32_funcs->SQLFreeStmt) -+ ret = handle->win32_funcs->SQLFreeStmt(handle->win32_handle, SQL_CLOSE); -+ else -+ ERR("Failed to free statement HANDLE\n"); -+ } -+ } - } - - RegCloseKey( handle->drivers_key ); --- -2.43.0 - 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 new file mode 100644 index 00000000..cfac3091 --- /dev/null +++ b/patches/odbc32-fixes/0001-odbc32-Support-freeing-SQL-handles-for-ODBC-v2-drive.patch @@ -0,0 +1,82 @@ +From 56d18e7bd712c917f91e837918491def4b0f587d 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. + +--- + dlls/odbc32/proxyodbc.c | 37 ++++++++++++++++++++++++++++++++++--- + 1 file changed, 34 insertions(+), 3 deletions(-) + +diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c +index b71ef7aac42..2a38197b243 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 ); ++ } ++ else ++ { ++ /* ODBC v2 */ ++ if (type == SQL_HANDLE_ENV) ++ { ++ if (handle->win32_funcs->SQLFreeEnv) ++ ret = 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 ); ++ } ++ else if (type == SQL_HANDLE_STMT) ++ { ++ if (handle->win32_funcs->SQLFreeStmt) ++ ret = handle->win32_funcs->SQLFreeStmt( handle->win32_handle, option ); ++ } ++ } ++ ++ 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 ); + } + + 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 new file mode 100644 index 00000000..c1727c14 --- /dev/null +++ b/patches/odbc32-fixes/0002-odbc32-SQLSetEnvAttr-isnt-supported-in-ODBC-v2.0.patch @@ -0,0 +1,35 @@ +From dc6b1e2572c7210ece06a3a9665738d3f811b4ba 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 + +--- + 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 +--- a/dlls/odbc32/proxyodbc.c ++++ b/dlls/odbc32/proxyodbc.c +@@ -839,7 +839,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 ) + { +- SQLRETURN ret = SQL_ERROR; ++ SQLRETURN ret = SQL_SUCCESS; + + if (handle->unix_handle) + { +@@ -848,7 +848,8 @@ static SQLRETURN set_env_attr( struct handle *handle, SQLINTEGER attr, SQLPOINTE + } + else if (handle->win32_handle) + { +- ret = handle->win32_funcs->SQLSetEnvAttr( handle->win32_handle, attr, value, len ); ++ if (handle->win32_funcs->SQLSetEnvAttr) ++ ret = handle->win32_funcs->SQLSetEnvAttr( handle->win32_handle, attr, value, len ); + } + return ret; + } +-- +2.43.0 + 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 new file mode 100644 index 00000000..0750c9bc --- /dev/null +++ b/patches/odbc32-fixes/0003-odbc32-Support-Allocating-SQL-handles-for-ODBC-v2-dr.patch @@ -0,0 +1,101 @@ +From de93b39154c4d964036d4fac9854bb4593a894a0 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. + +--- + dlls/odbc32/proxyodbc.c | 42 ++++++++++++++++++++++++++++++++++++----- + 1 file changed, 37 insertions(+), 5 deletions(-) + +diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c +index 741555f6582..e8e08fb7d00 100644 +--- a/dlls/odbc32/proxyodbc.c ++++ b/dlls/odbc32/proxyodbc.c +@@ -410,6 +410,38 @@ SQLRETURN WINAPI SQLAllocEnv(SQLHENV *EnvironmentHandle) + return ret; + } + ++static SQLRETURN allochandle_win32(struct handle *handle, SQLSMALLINT type, SQLHANDLE InputHandle, SQLHANDLE *OutputHandle) ++{ ++ SQLRETURN ret = SQL_ERROR; ++ ++ if (handle->win32_funcs->SQLAllocHandle) ++ { ++ if ((ret = handle->win32_funcs->SQLAllocHandle( type, InputHandle, OutputHandle ))) ++ return ret; ++ } ++ else ++ { ++ /* ODBC v2 */ ++ if (type == SQL_HANDLE_ENV) ++ { ++ if (handle->win32_funcs->SQLAllocEnv) ++ ret = handle->win32_funcs->SQLAllocEnv( OutputHandle ); ++ } ++ else if (type == SQL_HANDLE_DBC) ++ { ++ if (handle->win32_funcs->SQLAllocConnect) ++ ret = handle->win32_funcs->SQLAllocConnect( InputHandle, OutputHandle ); ++ } ++ else if (type == SQL_HANDLE_STMT) ++ { ++ if (handle->win32_funcs->SQLAllocStmt) ++ ret = handle->win32_funcs->SQLAllocStmt( InputHandle, OutputHandle ); ++ } ++ } ++ ++ 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 ) + } + 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; + } + + return prepare_env( handle ); +@@ -930,7 +962,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 ))) + return ret; + } + +-- +2.43.0 + diff --git a/patches/odbc32-fixes/0002-odbc32-Support-Driver-in-connection-string.patch b/patches/odbc32-fixes/0004-odbc32-Support-Driver-in-connection-string.patch similarity index 85% rename from patches/odbc32-fixes/0002-odbc32-Support-Driver-in-connection-string.patch rename to patches/odbc32-fixes/0004-odbc32-Support-Driver-in-connection-string.patch index 469c5b4f..09d01722 100644 --- a/patches/odbc32-fixes/0002-odbc32-Support-Driver-in-connection-string.patch +++ b/patches/odbc32-fixes/0004-odbc32-Support-Driver-in-connection-string.patch @@ -1,17 +1,17 @@ -From 630f3a7724e39207f00bcf8a82d5b32acf4d4d21 Mon Sep 17 00:00:00 2001 +From 02839f3df7ab1c8417a3ecd507a2b7c24dc6963f 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 +Subject: [PATCH 04/15] odbc32: Support Driver in connection string --- - dlls/odbc32/proxyodbc.c | 97 +++++++++++++++++++++++++++++++---------- - 1 file changed, 74 insertions(+), 23 deletions(-) + dlls/odbc32/proxyodbc.c | 100 +++++++++++++++++++++++++++++++--------- + 1 file changed, 77 insertions(+), 23 deletions(-) diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index 4043c20177b..1cf06658808 100644 +index e8e08fb7d00..511fd8c9de3 100644 --- a/dlls/odbc32/proxyodbc.c +++ b/dlls/odbc32/proxyodbc.c -@@ -789,11 +789,20 @@ static WCHAR *strdupAW( const char *src ) +@@ -821,11 +821,20 @@ static WCHAR *strdupAW( const char *src ) return dst; } @@ -34,7 +34,7 @@ index 4043c20177b..1cf06658808 100644 return NULL; } -@@ -807,12 +816,12 @@ static WCHAR *get_reg_value( HKEY key, const WCHAR *name ) +@@ -839,12 +848,12 @@ static WCHAR *get_reg_value( HKEY key, const WCHAR *name ) return NULL; } @@ -49,7 +49,7 @@ index 4043c20177b..1cf06658808 100644 if (!RegOpenKeyExW( key_root, source, 0, KEY_READ, &key_source )) { ret = get_reg_value( key_source, L"Driver" ); -@@ -821,7 +830,7 @@ static WCHAR *get_driver_filename( const SQLWCHAR *source ) +@@ -853,7 +862,7 @@ static WCHAR *get_driver_filename( const SQLWCHAR *source ) RegCloseKey( key_root ); if (ret) return ret; @@ -58,7 +58,7 @@ index 4043c20177b..1cf06658808 100644 if (!RegOpenKeyExW( key_root, source, 0, KEY_READ, &key_source )) { ret = get_reg_value( key_source, L"Driver" ); -@@ -954,7 +963,7 @@ SQLRETURN WINAPI SQLConnect(SQLHDBC ConnectionHandle, SQLCHAR *ServerName, SQLSM +@@ -987,7 +996,7 @@ SQLRETURN WINAPI SQLConnect(SQLHDBC ConnectionHandle, SQLCHAR *ServerName, SQLSM if (!handle) return SQL_INVALID_HANDLE; @@ -67,7 +67,7 @@ index 4043c20177b..1cf06658808 100644 { WARN( "can't find driver filename\n" ); goto done; -@@ -2766,6 +2775,32 @@ static SQLRETURN browse_connect_unix_a( struct handle *handle, SQLCHAR *in_conn_ +@@ -2828,6 +2837,35 @@ static SQLRETURN browse_connect_unix_a( struct handle *handle, SQLCHAR *in_conn_ return ODBC_CALL( SQLBrowseConnect, ¶ms ); } @@ -83,7 +83,10 @@ index 4043c20177b..1cf06658808 100644 + if (!wcsnicmp( p, L"DRIVER=", 7 )) + { + p += 7; -+ q = wcschr( p, ';' ); ++ if (*p == '{') ++ q = wcschr( ++p, '}' ); ++ else ++ q = wcschr( p, ';' ); + len = q ? (q - p) : wcslen( p ); + if ((ret = malloc( (len + 1) * sizeof(WCHAR) ))) + { @@ -100,7 +103,7 @@ index 4043c20177b..1cf06658808 100644 /************************************************************************* * SQLBrowseConnect [ODBC32.055] */ -@@ -2775,6 +2810,7 @@ SQLRETURN WINAPI SQLBrowseConnect(SQLHDBC ConnectionHandle, SQLCHAR *InConnectio +@@ -2837,6 +2875,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; @@ -108,7 +111,7 @@ index 4043c20177b..1cf06658808 100644 TRACE("(ConnectionHandle %p, InConnectionString %s, StringLength1 %d, OutConnectionString %p, BufferLength, %d, " "StringLength2 %p)\n", ConnectionHandle, debugstr_sqlstr(InConnectionString, StringLength1), -@@ -2782,13 +2818,16 @@ SQLRETURN WINAPI SQLBrowseConnect(SQLHDBC ConnectionHandle, SQLCHAR *InConnectio +@@ -2844,13 +2883,16 @@ SQLRETURN WINAPI SQLBrowseConnect(SQLHDBC ConnectionHandle, SQLCHAR *InConnectio if (!handle) return SQL_INVALID_HANDLE; @@ -129,7 +132,7 @@ index 4043c20177b..1cf06658808 100644 { WARN( "can't find driver filename\n" ); goto done; -@@ -3505,6 +3544,7 @@ SQLRETURN WINAPI SQLDriverConnect(SQLHDBC ConnectionHandle, SQLHWND WindowHandle +@@ -3567,6 +3609,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; @@ -137,7 +140,7 @@ index 4043c20177b..1cf06658808 100644 TRACE("(ConnectionHandle %p, WindowHandle %p, InConnectionString %s, Length %d, OutConnectionString %p," " BufferLength %d, Length2 %p, DriverCompletion %d)\n", ConnectionHandle, WindowHandle, -@@ -3513,13 +3553,16 @@ SQLRETURN WINAPI SQLDriverConnect(SQLHDBC ConnectionHandle, SQLHWND WindowHandle +@@ -3575,13 +3618,16 @@ SQLRETURN WINAPI SQLDriverConnect(SQLHDBC ConnectionHandle, SQLHWND WindowHandle if (!handle) return SQL_INVALID_HANDLE; @@ -158,7 +161,7 @@ index 4043c20177b..1cf06658808 100644 { WARN( "can't find driver filename\n" ); goto done; -@@ -3702,7 +3745,7 @@ SQLRETURN WINAPI SQLConnectW(SQLHDBC ConnectionHandle, WCHAR *ServerName, SQLSMA +@@ -3764,7 +3810,7 @@ SQLRETURN WINAPI SQLConnectW(SQLHDBC ConnectionHandle, WCHAR *ServerName, SQLSMA if (!handle) return SQL_INVALID_HANDLE; @@ -167,7 +170,7 @@ index 4043c20177b..1cf06658808 100644 { WARN( "can't find driver filename\n" ); goto done; -@@ -4327,6 +4370,7 @@ SQLRETURN WINAPI SQLDriverConnectW(SQLHDBC ConnectionHandle, SQLHWND WindowHandl +@@ -4395,6 +4441,7 @@ SQLRETURN WINAPI SQLDriverConnectW(SQLHDBC ConnectionHandle, SQLHWND WindowHandl struct handle *handle = ConnectionHandle; WCHAR *datasource, *filename = NULL; SQLRETURN ret = SQL_ERROR; @@ -175,7 +178,7 @@ index 4043c20177b..1cf06658808 100644 TRACE("(ConnectionHandle %p, WindowHandle %p, InConnectionString %s, Length %d, OutConnectionString %p," " BufferLength %d, Length2 %p, DriverCompletion %d)\n", ConnectionHandle, WindowHandle, -@@ -4335,13 +4379,16 @@ SQLRETURN WINAPI SQLDriverConnectW(SQLHDBC ConnectionHandle, SQLHWND WindowHandl +@@ -4403,13 +4450,16 @@ SQLRETURN WINAPI SQLDriverConnectW(SQLHDBC ConnectionHandle, SQLHWND WindowHandl if (!handle) return SQL_INVALID_HANDLE; @@ -196,7 +199,7 @@ index 4043c20177b..1cf06658808 100644 { WARN( "can't find driver filename\n" ); goto done; -@@ -4633,6 +4680,7 @@ SQLRETURN WINAPI SQLBrowseConnectW(SQLHDBC ConnectionHandle, SQLWCHAR *InConnect +@@ -4701,6 +4751,7 @@ SQLRETURN WINAPI SQLBrowseConnectW(SQLHDBC ConnectionHandle, SQLWCHAR *InConnect struct handle *handle = ConnectionHandle; WCHAR *datasource, *filename = NULL; SQLRETURN ret = SQL_ERROR; @@ -204,7 +207,7 @@ index 4043c20177b..1cf06658808 100644 TRACE("(ConnectionHandle %p, InConnectionString %s, StringLength1 %d, OutConnectionString %p, BufferLength %d, " "StringLength2 %p)\n", ConnectionHandle, debugstr_sqlwstr(InConnectionString, StringLength1), StringLength1, -@@ -4640,13 +4688,16 @@ SQLRETURN WINAPI SQLBrowseConnectW(SQLHDBC ConnectionHandle, SQLWCHAR *InConnect +@@ -4708,13 +4759,16 @@ SQLRETURN WINAPI SQLBrowseConnectW(SQLHDBC ConnectionHandle, SQLWCHAR *InConnect if (!handle) return SQL_INVALID_HANDLE; diff --git a/patches/odbc32-fixes/0003-odbc32-SQLColAttributeW-support-fallback-function.patch b/patches/odbc32-fixes/0005-odbc32-SQLColAttributeW-support-fallback-function.patch similarity index 85% rename from patches/odbc32-fixes/0003-odbc32-SQLColAttributeW-support-fallback-function.patch rename to patches/odbc32-fixes/0005-odbc32-SQLColAttributeW-support-fallback-function.patch index 6412836d..08702a65 100644 --- a/patches/odbc32-fixes/0003-odbc32-SQLColAttributeW-support-fallback-function.patch +++ b/patches/odbc32-fixes/0005-odbc32-SQLColAttributeW-support-fallback-function.patch @@ -1,17 +1,17 @@ -From 1c08cf741851d3f774a64fa905586053748564a6 Mon Sep 17 00:00:00 2001 +From c036cbda4e49b15e0a8dea55bb346929db5ce6c2 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Fri, 12 Jul 2024 14:19:22 +1000 -Subject: [PATCH] odbc32: SQLColAttributeW support fallback function +Subject: [PATCH 05/15] 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 b6913ae2624..c729733750a 100644 +index 511fd8c9de3..1f51ac2a27e 100644 --- a/dlls/odbc32/proxyodbc.c +++ b/dlls/odbc32/proxyodbc.c -@@ -3989,6 +3989,21 @@ static SQLRETURN col_attribute_unix_w( struct handle *handle, SQLUSMALLINT col, +@@ -4060,6 +4060,21 @@ static SQLRETURN col_attribute_unix_w( struct handle *handle, SQLUSMALLINT col, return ret; } @@ -33,7 +33,7 @@ index b6913ae2624..c729733750a 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 ) -@@ -3996,6 +4011,14 @@ static SQLRETURN col_attribute_win32_w( struct handle *handle, SQLUSMALLINT col, +@@ -4067,6 +4082,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/0005-odbc32-SQLGetDiagRec-W-handle-fallback-function.patch b/patches/odbc32-fixes/0006-odbc32-SQLGetDiagRec-W-handle-fallback-function.patch similarity index 90% rename from patches/odbc32-fixes/0005-odbc32-SQLGetDiagRec-W-handle-fallback-function.patch rename to patches/odbc32-fixes/0006-odbc32-SQLGetDiagRec-W-handle-fallback-function.patch index 1c9c978e..08c5ea97 100644 --- a/patches/odbc32-fixes/0005-odbc32-SQLGetDiagRec-W-handle-fallback-function.patch +++ b/patches/odbc32-fixes/0006-odbc32-SQLGetDiagRec-W-handle-fallback-function.patch @@ -1,17 +1,17 @@ -From aef32555c4c66db02760335f30ca060f83c7df9c Mon Sep 17 00:00:00 2001 +From c72487ac8ae2279f43da906df6ac430fa55e2ae9 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Fri, 12 Jul 2024 14:29:17 +1000 -Subject: [PATCH] odbc32: SQLGetDiagRec/W handle fallback function +Subject: [PATCH 06/15] odbc32: SQLGetDiagRec/W handle fallback function --- dlls/odbc32/proxyodbc.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index 7c34d905154..53c2cdb4362 100644 +index 1f51ac2a27e..c4e1c046edc 100644 --- a/dlls/odbc32/proxyodbc.c +++ b/dlls/odbc32/proxyodbc.c -@@ -1872,7 +1872,21 @@ SQLRETURN WINAPI SQLGetDiagRec(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMAL +@@ -1915,7 +1915,21 @@ SQLRETURN WINAPI SQLGetDiagRec(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMAL } else if (handle->win32_handle) { @@ -34,7 +34,7 @@ index 7c34d905154..53c2cdb4362 100644 TextLength ); } -@@ -4228,6 +4242,19 @@ static SQLRETURN get_diag_rec_win32_w( SQLSMALLINT handle_type, struct handle *h +@@ -4285,6 +4299,19 @@ static SQLRETURN get_diag_rec_win32_w( SQLSMALLINT handle_type, struct handle *h if (handle->win32_funcs->SQLGetDiagRecW) return handle->win32_funcs->SQLGetDiagRecW( handle_type, handle->win32_handle, rec_num, state, native_err, msg, buflen, retlen ); diff --git a/patches/odbc32-fixes/0006-odbc32-Load-function-pointer-for-SQLBindParam.patch b/patches/odbc32-fixes/0007-odbc32-Load-function-pointer-for-SQLBindParam.patch similarity index 88% rename from patches/odbc32-fixes/0006-odbc32-Load-function-pointer-for-SQLBindParam.patch rename to patches/odbc32-fixes/0007-odbc32-Load-function-pointer-for-SQLBindParam.patch index fb79a0d5..20177821 100644 --- a/patches/odbc32-fixes/0006-odbc32-Load-function-pointer-for-SQLBindParam.patch +++ b/patches/odbc32-fixes/0007-odbc32-Load-function-pointer-for-SQLBindParam.patch @@ -1,14 +1,14 @@ -From 42067e027dac84d160c869564f5c7dbafe9fe657 Mon Sep 17 00:00:00 2001 +From cace313e628d0edd434f6f30c911f7bd91062adb Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Fri, 12 Jul 2024 14:44:43 +1000 -Subject: [PATCH] odbc32: Load function pointer for SQLBindParam +Subject: [PATCH 07/15] odbc32: Load function pointer for SQLBindParam --- dlls/odbc32/proxyodbc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index 53c2cdb4362..3d900e7ac17 100644 +index c4e1c046edc..6eb15687f92 100644 --- a/dlls/odbc32/proxyodbc.c +++ b/dlls/odbc32/proxyodbc.c @@ -50,6 +50,7 @@ struct win32_funcs diff --git a/patches/odbc32-fixes/0007-odbc32-SQLBindParameter-handle-fallback-function.patch b/patches/odbc32-fixes/0008-odbc32-SQLBindParameter-handle-fallback-function.patch similarity index 89% rename from patches/odbc32-fixes/0007-odbc32-SQLBindParameter-handle-fallback-function.patch rename to patches/odbc32-fixes/0008-odbc32-SQLBindParameter-handle-fallback-function.patch index 0635ef0a..f098354e 100644 --- a/patches/odbc32-fixes/0007-odbc32-SQLBindParameter-handle-fallback-function.patch +++ b/patches/odbc32-fixes/0008-odbc32-SQLBindParameter-handle-fallback-function.patch @@ -1,17 +1,17 @@ -From eb9fa655f1a1a6f209763e13ba7ee192cdc59be3 Mon Sep 17 00:00:00 2001 +From d3e972d613def74c2b59757ca25653303cb652bf Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Fri, 12 Jul 2024 14:40:32 +1000 -Subject: [PATCH] odbc32: SQLBindParameter handle fallback function +Subject: [PATCH 08/15] odbc32: SQLBindParameter handle fallback function --- dlls/odbc32/proxyodbc.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index d218efb9545..11fcbe97be8 100644 +index 6eb15687f92..462661f43de 100644 --- a/dlls/odbc32/proxyodbc.c +++ b/dlls/odbc32/proxyodbc.c -@@ -3367,9 +3367,34 @@ SQLRETURN WINAPI SQLBindParameter(SQLHSTMT StatementHandle, SQLUSMALLINT Paramet +@@ -3570,9 +3570,34 @@ SQLRETURN WINAPI SQLBindParameter(SQLHSTMT StatementHandle, SQLUSMALLINT Paramet } else if (handle->win32_handle) { diff --git a/patches/odbc32-fixes/0008-odbc32-SQLSetConnectAttr-W-handle-fallback-function.patch b/patches/odbc32-fixes/0009-odbc32-SQLSetConnectAttr-W-handle-fallback-function.patch similarity index 83% rename from patches/odbc32-fixes/0008-odbc32-SQLSetConnectAttr-W-handle-fallback-function.patch rename to patches/odbc32-fixes/0009-odbc32-SQLSetConnectAttr-W-handle-fallback-function.patch index 53726ad2..33692bf9 100644 --- a/patches/odbc32-fixes/0008-odbc32-SQLSetConnectAttr-W-handle-fallback-function.patch +++ b/patches/odbc32-fixes/0009-odbc32-SQLSetConnectAttr-W-handle-fallback-function.patch @@ -1,17 +1,17 @@ -From 2834d453dab7a66f3d16bada6c295a828d14d4f0 Mon Sep 17 00:00:00 2001 +From 20bf2dea9241d387c9415d816ea96e1947d8a710 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Fri, 12 Jul 2024 14:55:47 +1000 -Subject: [PATCH] odbc32: SQLSetConnectAttr/W handle fallback function +Subject: [PATCH 09/15] odbc32: SQLSetConnectAttr/W handle fallback function --- dlls/odbc32/proxyodbc.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index 11fcbe97be8..1c92560d7ee 100644 +index 462661f43de..e24557fbb11 100644 --- a/dlls/odbc32/proxyodbc.c +++ b/dlls/odbc32/proxyodbc.c -@@ -2194,7 +2194,13 @@ SQLRETURN WINAPI SQLSetConnectAttr(SQLHDBC ConnectionHandle, SQLINTEGER Attribut +@@ -2301,7 +2301,13 @@ SQLRETURN WINAPI SQLSetConnectAttr(SQLHDBC ConnectionHandle, SQLINTEGER Attribut } else if (handle->win32_handle) { @@ -26,7 +26,7 @@ index 11fcbe97be8..1c92560d7ee 100644 } else { -@@ -4133,7 +4139,13 @@ SQLRETURN WINAPI SQLSetConnectAttrW(SQLHDBC ConnectionHandle, SQLINTEGER Attribu +@@ -4429,7 +4435,13 @@ SQLRETURN WINAPI SQLSetConnectAttrW(SQLHDBC ConnectionHandle, SQLINTEGER Attribu } else if (handle->win32_handle) { diff --git a/patches/odbc32-fixes/0011-odbc32-Store-handles-when-requesting-information-of-.patch b/patches/odbc32-fixes/0010-odbc32-Store-handles-when-requesting-information-of-.patch similarity index 93% rename from patches/odbc32-fixes/0011-odbc32-Store-handles-when-requesting-information-of-.patch rename to patches/odbc32-fixes/0010-odbc32-Store-handles-when-requesting-information-of-.patch index 2319923d..3589d789 100644 --- a/patches/odbc32-fixes/0011-odbc32-Store-handles-when-requesting-information-of-.patch +++ b/patches/odbc32-fixes/0010-odbc32-Store-handles-when-requesting-information-of-.patch @@ -1,7 +1,8 @@ -From 3b48c805fbb5deef6aa11b9a31948e60a53916a8 Mon Sep 17 00:00:00 2001 +From e713bad9827c44a5a7db842845888b67667ae4e7 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. +Subject: [PATCH 10/15] odbc32: Store handles when requesting information of + Columns. --- dlls/odbc32/proxyodbc.c | 34 +++++++++++++++++++++++++++++++++- @@ -9,10 +10,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 550e7b16be4..c6ee7aac7c6 100644 +index e24557fbb11..3a9c2802d45 100644 --- a/dlls/odbc32/proxyodbc.c +++ b/dlls/odbc32/proxyodbc.c -@@ -4115,7 +4115,39 @@ SQLRETURN WINAPI SQLGetStmtAttrW(SQLHSTMT StatementHandle, SQLINTEGER Attribute, +@@ -4407,7 +4407,39 @@ SQLRETURN WINAPI SQLGetStmtAttrW(SQLHSTMT StatementHandle, SQLINTEGER Attribute, } else if (handle->win32_handle) { diff --git a/patches/odbc32-fixes/0012-odbc32-SQLSetDescFieldW-pass-correct-handle-onto-dri.patch b/patches/odbc32-fixes/0011-odbc32-SQLSetDescFieldW-pass-correct-handle-onto-dri.patch similarity index 84% rename from patches/odbc32-fixes/0012-odbc32-SQLSetDescFieldW-pass-correct-handle-onto-dri.patch rename to patches/odbc32-fixes/0011-odbc32-SQLSetDescFieldW-pass-correct-handle-onto-dri.patch index eca80ed1..627e7ec4 100644 --- a/patches/odbc32-fixes/0012-odbc32-SQLSetDescFieldW-pass-correct-handle-onto-dri.patch +++ b/patches/odbc32-fixes/0011-odbc32-SQLSetDescFieldW-pass-correct-handle-onto-dri.patch @@ -1,17 +1,18 @@ -From d674ddfe44df7b744c2e5a957b49fb5cd924a24e Mon Sep 17 00:00:00 2001 +From 8c26d09014cdf26756bd808e2c076d9d10f6295f Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Sat, 13 Jul 2024 15:23:10 +1000 -Subject: [PATCH] odbc32: SQLSetDescFieldW pass correct handle onto driver +Subject: [PATCH 11/15] 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 d0df1323d19..475be883bcb 100644 +index 3a9c2802d45..c70b0d80012 100644 --- a/dlls/odbc32/proxyodbc.c +++ b/dlls/odbc32/proxyodbc.c -@@ -4334,7 +4334,7 @@ SQLRETURN WINAPI SQLGetStmtAttrW(SQLHSTMT StatementHandle, SQLINTEGER Attribute, +@@ -4387,7 +4387,7 @@ SQLRETURN WINAPI SQLGetStmtAttrW(SQLHSTMT StatementHandle, SQLINTEGER Attribute, SQLINTEGER BufferLength, SQLINTEGER *StringLength) { struct handle *handle = StatementHandle; @@ -20,7 +21,7 @@ index d0df1323d19..475be883bcb 100644 TRACE("(StatementHandle %p, Attribute %d, Value %p, BufferLength %d, StringLength %p)\n", StatementHandle, Attribute, Value, BufferLength, StringLength); -@@ -5246,7 +5246,8 @@ done: +@@ -5299,7 +5299,8 @@ done: SQLRETURN WINAPI SQLSetDescFieldW(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier, SQLPOINTER Value, SQLINTEGER BufferLength) { @@ -30,7 +31,7 @@ index d0df1323d19..475be883bcb 100644 SQLRETURN ret = SQL_ERROR; TRACE("(DescriptorHandle %p, RecNumber %d, FieldIdentifier %d, Value %p, BufferLength %d)\n", DescriptorHandle, -@@ -5262,7 +5263,11 @@ SQLRETURN WINAPI SQLSetDescFieldW(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumb +@@ -5315,7 +5316,11 @@ SQLRETURN WINAPI SQLSetDescFieldW(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumb } else if (handle->win32_handle) { diff --git a/patches/odbc32-fixes/0016-odbc32-Record-loaded-driver-SQL_ATTR_ODBC_VERSION.patch b/patches/odbc32-fixes/0012-odbc32-Record-loaded-driver-SQL_ATTR_ODBC_VERSION.patch similarity index 80% rename from patches/odbc32-fixes/0016-odbc32-Record-loaded-driver-SQL_ATTR_ODBC_VERSION.patch rename to patches/odbc32-fixes/0012-odbc32-Record-loaded-driver-SQL_ATTR_ODBC_VERSION.patch index f9558495..ed276e19 100644 --- a/patches/odbc32-fixes/0016-odbc32-Record-loaded-driver-SQL_ATTR_ODBC_VERSION.patch +++ b/patches/odbc32-fixes/0012-odbc32-Record-loaded-driver-SQL_ATTR_ODBC_VERSION.patch @@ -1,7 +1,7 @@ -From 3472c0211aa199df18e0d328d31d9efc290b89b4 Mon Sep 17 00:00:00 2001 +From 826649e599a8e8c68b468771aded099c659c0e72 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Thu, 18 Jul 2024 07:13:48 +1000 -Subject: [PATCH] odbc32: Record loaded driver SQL_ATTR_ODBC_VERSION +Subject: [PATCH 12/15] odbc32: Record loaded driver SQL_ATTR_ODBC_VERSION --- dlls/odbc32/proxyodbc.c | 4 ++++ @@ -9,7 +9,7 @@ Subject: [PATCH] odbc32: Record loaded driver SQL_ATTR_ODBC_VERSION 2 files changed, 5 insertions(+) diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index e6ffd4d6fc7..611362dbd7c 100644 +index c70b0d80012..bb1cae25051 100644 --- a/dlls/odbc32/proxyodbc.c +++ b/dlls/odbc32/proxyodbc.c @@ -376,6 +376,7 @@ static struct handle *create_handle( struct handle *parent ) @@ -20,7 +20,7 @@ index e6ffd4d6fc7..611362dbd7c 100644 ret->row_count = 1; return ret; } -@@ -872,6 +873,9 @@ static SQLRETURN set_env_attr( struct handle *handle, SQLINTEGER attr, SQLPOINTE +@@ -891,6 +892,9 @@ static SQLRETURN set_env_attr( struct handle *handle, SQLINTEGER attr, SQLPOINTE } else if (handle->win32_handle) { @@ -28,7 +28,7 @@ index e6ffd4d6fc7..611362dbd7c 100644 + ret = handle->win32_funcs->SQLGetEnvAttr( handle->win32_handle, SQL_ATTR_ODBC_VERSION, &handle->driver_ver, 0, NULL ); + if (handle->win32_funcs->SQLSetEnvAttr) - ret = handle->win32_funcs->SQLSetEnvAttr( handle->win32_handle, attr, value, len ); + ret = handle->win32_funcs->SQLSetEnvAttr( handle->win32_handle, attr, value, len ); } diff --git a/dlls/odbc32/unixlib.h b/dlls/odbc32/unixlib.h index fc69857c8b7..61b8429768d 100644 diff --git a/patches/odbc32-fixes/0017-odbc32-SQLGetData-support-ODBC-v2.0.patch b/patches/odbc32-fixes/0013-odbc32-SQLGetData-support-ODBC-v2.0.patch similarity index 81% rename from patches/odbc32-fixes/0017-odbc32-SQLGetData-support-ODBC-v2.0.patch rename to patches/odbc32-fixes/0013-odbc32-SQLGetData-support-ODBC-v2.0.patch index 1ce7e4ef..876a3753 100644 --- a/patches/odbc32-fixes/0017-odbc32-SQLGetData-support-ODBC-v2.0.patch +++ b/patches/odbc32-fixes/0013-odbc32-SQLGetData-support-ODBC-v2.0.patch @@ -1,17 +1,17 @@ -From 610fdcdfc1a63432a6476adc46050fbe30db4f81 Mon Sep 17 00:00:00 2001 +From d83dcacabf0918cc4cdeb3d6358585d9178defa8 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Wed, 17 Jul 2024 21:55:20 +1000 -Subject: [PATCH] odbc32: SQLGetData support ODBC v2.0 +Subject: [PATCH 13/15] odbc32: SQLGetData support ODBC v2.0 --- dlls/odbc32/proxyodbc.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index 611362dbd7c..9ca4f35c332 100644 +index bb1cae25051..a66ec99b913 100644 --- a/dlls/odbc32/proxyodbc.c +++ b/dlls/odbc32/proxyodbc.c -@@ -1750,6 +1750,15 @@ SQLRETURN WINAPI SQLGetData(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber, +@@ -1761,6 +1761,15 @@ SQLRETURN WINAPI SQLGetData(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber, } else if (handle->win32_handle) { diff --git a/patches/odbc32-fixes/0014-odbc32-SQLColAttributesW-support-ODBC-v2.0.patch b/patches/odbc32-fixes/0014-odbc32-SQLColAttributesW-support-ODBC-v2.0.patch new file mode 100644 index 00000000..6015a7f5 --- /dev/null +++ b/patches/odbc32-fixes/0014-odbc32-SQLColAttributesW-support-ODBC-v2.0.patch @@ -0,0 +1,45 @@ +From c41312e28ac2c500aad9e5cdbbbee4670f4b4a86 Mon Sep 17 00:00:00 2001 +From: Alistair Leslie-Hughes +Date: Wed, 17 Jul 2024 22:03:03 +1000 +Subject: [PATCH 14/15] odbc32: SQLColAttributesW support ODBC v2.0 + +--- + dlls/odbc32/proxyodbc.c | 18 +++++++++++++++++- + 1 file changed, 17 insertions(+), 1 deletion(-) + +diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c +index a66ec99b913..a9d23c94504 100644 +--- a/dlls/odbc32/proxyodbc.c ++++ b/dlls/odbc32/proxyodbc.c +@@ -4144,11 +4144,27 @@ static SQLRETURN col_attribute_win32_w( struct handle *handle, SQLUSMALLINT col, + retlen, num_attr ); + else if(handle->win32_funcs->SQLColAttributesW) + { ++ SQLRETURN ret; ++ + /* ODBC v2 */ + field_id = map_odbc3_to_2(field_id); +- return handle->win32_funcs->SQLColAttributesW( handle->win32_handle, col, field_id, ++ ret = handle->win32_funcs->SQLColAttributesW( handle->win32_handle, col, field_id, + char_attr, buflen, retlen, + num_attr ); ++ /* Convert back for ODBC3 drivers */ ++ if (num_attr && field_id == SQL_COLUMN_TYPE && ++ handle->env_attr_version == SQL_OV_ODBC2 && ++ handle->driver_ver == SQL_OV_ODBC3) ++ { ++ if (*num_attr == SQL_TIME) ++ *num_attr = SQL_TYPE_TIME; ++ else if (*num_attr == SQL_DATETIME) ++ *num_attr = SQL_TYPE_DATE; ++ else if (*num_attr == SQL_TIMESTAMP) ++ *num_attr = SQL_TYPE_TIMESTAMP; ++ } ++ ++ return ret; + } + if (handle->win32_funcs->SQLColAttribute) FIXME( "Unicode to ANSI conversion not handled\n" ); + return SQL_ERROR; +-- +2.43.0 + diff --git a/patches/odbc32-fixes/0014-odbc32-Support-Creating-Environment-handle-with-ODBC.patch b/patches/odbc32-fixes/0014-odbc32-Support-Creating-Environment-handle-with-ODBC.patch deleted file mode 100644 index 6b1e5c15..00000000 --- a/patches/odbc32-fixes/0014-odbc32-Support-Creating-Environment-handle-with-ODBC.patch +++ /dev/null @@ -1,83 +0,0 @@ -From 3a85cd3851edb650d8cac1d4b2275150c8314bdd Mon Sep 17 00:00:00 2001 -From: Alistair Leslie-Hughes -Date: Sun, 14 Jul 2024 20:05:13 +1000 -Subject: [PATCH] odbc32: Support Creating Environment handle with ODBC 2 - driver - ---- - 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 30f3d5f34e9..f8b68bf44a5 100644 ---- a/dlls/odbc32/proxyodbc.c -+++ b/dlls/odbc32/proxyodbc.c -@@ -814,7 +814,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 ) - { -- SQLRETURN ret = SQL_ERROR; -+ SQLRETURN ret = SQL_SUCCESS; - - if (handle->unix_handle) - { -@@ -823,7 +823,8 @@ static SQLRETURN set_env_attr( struct handle *handle, SQLINTEGER attr, SQLPOINTE - } - else if (handle->win32_handle) - { -- ret = handle->win32_funcs->SQLSetEnvAttr( handle->win32_handle, attr, value, len ); -+ if (handle->win32_funcs->SQLSetEnvAttr) -+ ret = handle->win32_funcs->SQLSetEnvAttr( handle->win32_handle, attr, value, len ); - } - return ret; - } -@@ -848,7 +849,15 @@ 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 (handle->win32_funcs->SQLAllocHandle) -+ { -+ if ((ret = handle->win32_funcs->SQLAllocHandle( SQL_HANDLE_ENV, NULL, &handle->win32_handle ))) return ret; -+ } -+ else if(handle->win32_funcs->SQLAllocEnv) -+ { -+ /* ODBC v2.0 */ -+ if ((ret = handle->win32_funcs->SQLAllocEnv(&handle->win32_handle ))) return ret; -+ } - } - - return prepare_env( handle ); -@@ -856,7 +865,7 @@ static SQLRETURN create_env( struct handle *handle, BOOL is_unix ) - - static SQLRETURN set_con_attr( struct handle *handle, SQLINTEGER attr, SQLPOINTER value, SQLINTEGER len ) - { -- SQLRETURN ret = SQL_ERROR; -+ SQLRETURN ret = SQL_SUCCESS; - - if (handle->unix_handle) - { -@@ -904,8 +913,18 @@ static SQLRETURN create_con( struct handle *handle ) - } - else - { -- if ((ret = handle->win32_funcs->SQLAllocHandle( SQL_HANDLE_DBC, parent->win32_handle, &handle->win32_handle ))) -- return ret; -+ if (handle->win32_funcs->SQLAllocHandle) -+ { -+ if ((ret = handle->win32_funcs->SQLAllocHandle( SQL_HANDLE_DBC, parent->win32_handle, &handle->win32_handle ))) -+ return ret; -+ } -+ else if (handle->win32_funcs->SQLAllocConnect) -+ { -+ if ((ret = handle->win32_funcs->SQLAllocConnect( parent->win32_handle, &handle->win32_handle ))) -+ return ret; -+ } -+ else -+ return SQL_ERROR; - } - - return prepare_con( handle ); --- -2.43.0 - diff --git a/patches/odbc32-fixes/0015-odbc32-SQLAllocHandle-use-fallback-for-ODBC-2.0.patch b/patches/odbc32-fixes/0015-odbc32-SQLAllocHandle-use-fallback-for-ODBC-2.0.patch deleted file mode 100644 index 340d662f..00000000 --- a/patches/odbc32-fixes/0015-odbc32-SQLAllocHandle-use-fallback-for-ODBC-2.0.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 0f53e844d9fba3ff36f340d989f7d16223a62dfd Mon Sep 17 00:00:00 2001 -From: Alistair Leslie-Hughes -Date: Wed, 17 Jul 2024 16:58:44 +1000 -Subject: [PATCH] odbc32: SQLAllocHandle use fallback for ODBC 2.0 - ---- - dlls/odbc32/proxyodbc.c | 15 ++++++++++++++- - 1 file changed, 14 insertions(+), 1 deletion(-) - -diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index dd68872743e..e6ffd4d6fc7 100644 ---- a/dlls/odbc32/proxyodbc.c -+++ b/dlls/odbc32/proxyodbc.c -@@ -440,7 +440,20 @@ 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 ); -+ if(input->win32_funcs->SQLAllocHandle) -+ ret = input->win32_funcs->SQLAllocHandle( HandleType, input->win32_handle, &output->win32_handle ); -+ else -+ { -+ /* ODBC v2.0 */ -+ if (HandleType == SQL_HANDLE_STMT) -+ { -+ if (input->win32_funcs->SQLAllocStmt) -+ { -+ ret = input->win32_funcs->SQLAllocStmt( input->win32_handle, &output->win32_handle ); -+ } -+ } -+ } -+ - if (SUCCESS( ret )) output->win32_funcs = input->win32_funcs; - } - --- -2.43.0 - diff --git a/patches/odbc32-fixes/0019-odbc32-SQLSetStmtAttrW-support-fallback-for-ODBC-v2..patch b/patches/odbc32-fixes/0015-odbc32-SQLSetStmtAttrW-support-fallback-for-ODBC-v2..patch similarity index 80% rename from patches/odbc32-fixes/0019-odbc32-SQLSetStmtAttrW-support-fallback-for-ODBC-v2..patch rename to patches/odbc32-fixes/0015-odbc32-SQLSetStmtAttrW-support-fallback-for-ODBC-v2..patch index a47a3ff9..486569de 100644 --- a/patches/odbc32-fixes/0019-odbc32-SQLSetStmtAttrW-support-fallback-for-ODBC-v2..patch +++ b/patches/odbc32-fixes/0015-odbc32-SQLSetStmtAttrW-support-fallback-for-ODBC-v2..patch @@ -1,17 +1,17 @@ -From fa52f2afdfb554e43ca32a137378e9aaa052a097 Mon Sep 17 00:00:00 2001 +From 270c8b4b7f1d7cd91c035545cf223742874ed76a Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Wed, 17 Jul 2024 22:04:39 +1000 -Subject: [PATCH] odbc32: SQLSetStmtAttrW support fallback for ODBC v2.0 +Subject: [PATCH 15/15] odbc32: SQLSetStmtAttrW support fallback for ODBC v2.0 --- dlls/odbc32/proxyodbc.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index 91881635cab..f6e2cd61436 100644 +index a9d23c94504..0de97b542d9 100644 --- a/dlls/odbc32/proxyodbc.c +++ b/dlls/odbc32/proxyodbc.c -@@ -5388,7 +5388,17 @@ SQLRETURN WINAPI SQLSetStmtAttrW(SQLHSTMT StatementHandle, SQLINTEGER Attribute, +@@ -5387,7 +5387,17 @@ SQLRETURN WINAPI SQLSetStmtAttrW(SQLHSTMT StatementHandle, SQLINTEGER Attribute, } else if (handle->win32_handle) { diff --git a/patches/odbc32-fixes/0018-odbc32-SQLColAttributesW-support-ODBC-v2.0.patch b/patches/odbc32-fixes/0018-odbc32-SQLColAttributesW-support-ODBC-v2.0.patch deleted file mode 100644 index 60209a2e..00000000 --- a/patches/odbc32-fixes/0018-odbc32-SQLColAttributesW-support-ODBC-v2.0.patch +++ /dev/null @@ -1,87 +0,0 @@ -From bd50499e151d9bb56254dcc8d3f745dd3e7828d6 Mon Sep 17 00:00:00 2001 -From: Alistair Leslie-Hughes -Date: Wed, 17 Jul 2024 22:03:03 +1000 -Subject: [PATCH] odbc32: SQLColAttributesW support ODBC v2.0 - ---- - dlls/odbc32/proxyodbc.c | 39 +++++++++++++++++++++++++++++++++++---- - 1 file changed, 35 insertions(+), 4 deletions(-) - -diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index 9ca4f35c332..91881635cab 100644 ---- a/dlls/odbc32/proxyodbc.c -+++ b/dlls/odbc32/proxyodbc.c -@@ -455,7 +455,12 @@ SQLRETURN WINAPI SQLAllocHandle(SQLSMALLINT HandleType, SQLHANDLE InputHandle, S - } - } - -- if (SUCCESS( ret )) output->win32_funcs = input->win32_funcs; -+ if (SUCCESS( ret )) -+ { -+ output->win32_funcs = input->win32_funcs; -+ output->env_attr_version = input->env_attr_version; -+ output->driver_ver = input->driver_ver; -+ } - } - - if (SUCCESS( ret )) *OutputHandle = output; -@@ -486,7 +491,12 @@ SQLRETURN WINAPI SQLAllocStmt(SQLHDBC ConnectionHandle, SQLHSTMT *StatementHandl - else if (con->win32_handle) - { - ret = con->win32_funcs->SQLAllocStmt( con->win32_handle, &stmt->win32_handle ); -- if (SUCCESS( ret )) stmt->win32_funcs = con->win32_funcs; -+ if (SUCCESS( ret )) -+ { -+ stmt->win32_funcs = con->win32_funcs; -+ stmt->env_attr_version = con->env_attr_version; -+ stmt->driver_ver = con->driver_ver; -+ } - } - - if (SUCCESS( ret )) *StatementHandle = stmt; -@@ -525,7 +535,12 @@ SQLRETURN WINAPI SQLAllocHandleStd(SQLSMALLINT HandleType, SQLHANDLE InputHandle - else if (input->win32_handle) - { - ret = input->win32_funcs->SQLAllocHandleStd( HandleType, input->win32_handle, &output->win32_handle ); -- if (SUCCESS( ret )) output->win32_funcs = input->win32_funcs; -+ if (SUCCESS( ret )) -+ { -+ output->win32_funcs = input->win32_funcs; -+ output->env_attr_version = input->env_attr_version; -+ output->driver_ver = input->driver_ver; -+ } - } - - if (SUCCESS( ret )) *OutputHandle = output; -@@ -4130,11 +4145,27 @@ static SQLRETURN col_attribute_win32_w( struct handle *handle, SQLUSMALLINT col, - retlen, num_attr ); - else if(handle->win32_funcs->SQLColAttributesW) - { -+ SQLRETURN ret; -+ - /* ODBC v2 */ - field_id = map_odbc3_to_2(field_id); -- return handle->win32_funcs->SQLColAttributesW( handle->win32_handle, col, field_id, -+ ret = handle->win32_funcs->SQLColAttributesW( handle->win32_handle, col, field_id, - char_attr, buflen, retlen, - num_attr ); -+ /* Convert back for ODBC3 drivers */ -+ if (num_attr && field_id == SQL_COLUMN_TYPE && -+ handle->env_attr_version == SQL_OV_ODBC2 && -+ handle->driver_ver == SQL_OV_ODBC3) -+ { -+ if (*num_attr == SQL_TIME) -+ *num_attr = SQL_TYPE_TIME; -+ else if (*num_attr == SQL_DATETIME) -+ *num_attr = SQL_TYPE_DATE; -+ else if (*num_attr == SQL_TIMESTAMP) -+ *num_attr = SQL_TYPE_TIMESTAMP; -+ } -+ -+ return ret; - } - if (handle->win32_funcs->SQLColAttribute) FIXME( "Unicode to ANSI conversion not handled\n" ); - return SQL_ERROR; --- -2.43.0 -