From 4af1f11315cc50f073f4ec278b73c5f3e9be71bf Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Tue, 13 Aug 2024 11:20:56 +1000 Subject: [PATCH] Rebase against d98f067294918aa5cfeadb576652dd8fd1757c38. --- ...reeing-SQL-handles-for-ODBC-v2-drive.patch | 42 ---- ...tEnvAttr-isnt-supported-in-ODBC-v2.0.patch | 22 +- ...llocating-SQL-handles-for-ODBC-v2-dr.patch | 71 ------ ...-Support-Driver-in-connection-string.patch | 222 ------------------ ...AttributeW-support-fallback-function.patch | 28 ++- ...etDiagRec-W-handle-fallback-function.patch | 56 +++-- ...ndParameter-handle-fallback-function.patch | 21 +- ...nnectAttr-W-handle-fallback-function.patch | 16 +- ...dles-when-requesting-information-of-.patch | 80 ++----- ...cFieldW-pass-correct-handle-onto-dri.patch | 48 ---- ...-loaded-driver-SQL_ATTR_ODBC_VERSION.patch | 36 +-- ...-odbc32-SQLGetData-support-ODBC-v2.0.patch | 12 +- ...-SQLColAttributesW-support-ODBC-v2.0.patch | 34 +-- ...tAttrW-support-fallback-for-ODBC-v2..patch | 16 +- ...t_con_attr-return-success-by-default.patch | 24 +- ...locHandle-to-allocated-a-STMT-handle.patch | 38 --- ...c32-Call-drivers-SQLBindCol-function.patch | 25 -- ...button-id-psh1-for-Properties-button.patch | 33 --- patches/printdlg-properties_btn/definition | 3 - staging/upstream-commit | 2 +- 20 files changed, 158 insertions(+), 671 deletions(-) delete mode 100644 patches/odbc32-fixes/0001-odbc32-Support-freeing-SQL-handles-for-ODBC-v2-drive.patch delete mode 100644 patches/odbc32-fixes/0003-odbc32-Support-Allocating-SQL-handles-for-ODBC-v2-dr.patch delete mode 100644 patches/odbc32-fixes/0004-odbc32-Support-Driver-in-connection-string.patch delete mode 100644 patches/odbc32-fixes/0011-odbc32-SQLSetDescFieldW-pass-correct-handle-onto-dri.patch delete mode 100644 patches/odbc32-fixes/0017-odbc32-Use-SQLAllocHandle-to-allocated-a-STMT-handle.patch delete mode 100644 patches/odbc32-fixes/0018-odbc32-Call-drivers-SQLBindCol-function.patch delete mode 100644 patches/printdlg-properties_btn/0001-printdlg-Allow-button-id-psh1-for-Properties-button.patch delete mode 100644 patches/printdlg-properties_btn/definition 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 deleted file mode 100644 index 2b2f7772..00000000 --- a/patches/odbc32-fixes/0001-odbc32-Support-freeing-SQL-handles-for-ODBC-v2-drive.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 49adfd79f730714b11c4d5f983ced05b26ffa52a Mon Sep 17 00:00:00 2001 -From: Alistair Leslie-Hughes -Date: Fri, 12 Jul 2024 13:42:26 +1000 -Subject: [PATCH] odbc32: Support freeing SQL handles for ODBC v2 drivers. - ---- - dlls/odbc32/proxyodbc.c | 19 +++++++++++++++++++ - 1 file changed, 19 insertions(+) - -diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index 4799ca0a11e..678d9260fbb 100644 ---- a/dlls/odbc32/proxyodbc.c -+++ b/dlls/odbc32/proxyodbc.c -@@ -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) -+ return handle->win32_funcs->SQLFreeEnv( handle->win32_handle ); -+ } -+ else if (type == SQL_HANDLE_DBC) -+ { -+ if (handle->win32_funcs->SQLFreeConnect) -+ return handle->win32_funcs->SQLFreeConnect( handle->win32_handle ); -+ } -+ else if (type == SQL_HANDLE_STMT) -+ { -+ if (handle->win32_funcs->SQLFreeStmt) -+ return handle->win32_funcs->SQLFreeStmt( handle->win32_handle, SQL_CLOSE ); -+ } -+ } - return SQL_ERROR; - } - --- -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 9dfdd3c1..0d49a2f4 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,4 +1,4 @@ -From 1966db0e2fe8ee752a7a59b970749235b3fa0e20 Mon Sep 17 00:00:00 2001 +From 8256bfe5ed31fd521b0baa9085819557653be5e3 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Thu, 18 Jul 2024 14:17:44 +1000 Subject: [PATCH] odbc32: SQLSetEnvAttr isnt supported in ODBC v2.0 @@ -8,28 +8,28 @@ Subject: [PATCH] odbc32: SQLSetEnvAttr isnt supported in ODBC v2.0 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index 6e51693e33c..0703e2f580d 100644 +index 2a62fd88d64..4f23c761f5a 100644 --- a/dlls/odbc32/proxyodbc.c +++ b/dlls/odbc32/proxyodbc.c -@@ -1010,7 +1010,7 @@ static int has_suffix( const WCHAR *str, const WCHAR *suffix ) +@@ -1162,7 +1162,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 ) + static SQLRETURN set_env_attr( struct environment *env, SQLINTEGER attr, SQLPOINTER value, SQLINTEGER len ) { - SQLRETURN ret = SQL_ERROR; + SQLRETURN ret = SQL_SUCCESS; - if (handle->unix_handle) + if (env->hdr.unix_handle) { -@@ -1019,7 +1019,8 @@ static SQLRETURN set_env_attr( struct handle *handle, SQLINTEGER attr, SQLPOINTE +@@ -1171,7 +1171,8 @@ static SQLRETURN set_env_attr( struct environment *env, SQLINTEGER attr, SQLPOIN } - else if (handle->win32_handle) + else if (env->hdr.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 ); +- ret = env->hdr.win32_funcs->SQLSetEnvAttr( env->hdr.win32_handle, attr, value, len ); ++ if (env->hdr.win32_funcs->SQLSetEnvAttr) ++ ret = env->hdr.win32_funcs->SQLSetEnvAttr( env->hdr.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 deleted file mode 100644 index 5e88ff18..00000000 --- a/patches/odbc32-fixes/0003-odbc32-Support-Allocating-SQL-handles-for-ODBC-v2-dr.patch +++ /dev/null @@ -1,71 +0,0 @@ -From c6edaf28df9e495ff173910c6e0124d244784f41 Mon Sep 17 00:00:00 2001 -From: Alistair Leslie-Hughes -Date: Thu, 18 Jul 2024 14:34:49 +1000 -Subject: [PATCH] odbc32: Support Allocating SQL handles for ODBC v2 drivers. - ---- - 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 6fe38e7a863..6168786084d 100644 ---- a/dlls/odbc32/proxyodbc.c -+++ b/dlls/odbc32/proxyodbc.c -@@ -439,13 +439,32 @@ static SQLRETURN alloc_handle_unix( SQLSMALLINT type, struct handle *input, stru - - static SQLRETURN alloc_handle_win32( SQLSMALLINT type, struct handle *input, struct handle *output ) - { -+ SQLRETURN ret = SQL_ERROR; - 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 (input->win32_funcs->SQLAllocEnv) -+ ret = input->win32_funcs->SQLAllocEnv( &output->win32_handle ); -+ } -+ else if (type == SQL_HANDLE_DBC) -+ { -+ if (input->win32_funcs->SQLAllocConnect) -+ ret = input->win32_funcs->SQLAllocConnect( input, &output->win32_handle ); -+ } -+ else if (type == SQL_HANDLE_STMT) -+ { -+ 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; - } - - /************************************************************************* -@@ -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 = alloc_handle_win32(SQL_HANDLE_ENV, handle, handle ))) return ret; - } - - return prepare_env( 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 = alloc_handle_win32(SQL_HANDLE_DBC, parent, handle ))) - return ret; - } - --- -2.43.0 - 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 deleted file mode 100644 index d0711afa..00000000 --- a/patches/odbc32-fixes/0004-odbc32-Support-Driver-in-connection-string.patch +++ /dev/null @@ -1,222 +0,0 @@ -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 - ---- - dlls/odbc32/proxyodbc.c | 100 ++++++++++++++++++++++++++++++---------- - 1 file changed, 75 insertions(+), 25 deletions(-) - -diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index 94504a8cc26..df8fa06dc57 100644 ---- a/dlls/odbc32/proxyodbc.c -+++ b/dlls/odbc32/proxyodbc.c -@@ -989,23 +989,28 @@ static HKEY open_odbcinst_key( void ) - return NULL; - } - --static WCHAR *get_driver_filename( const SQLWCHAR *source ) -+static WCHAR *get_driver_filename( const SQLWCHAR *source, BOOL is_dsn ) - { - HKEY key_sources, key_odbcinst, key_driver; - WCHAR *driver_name, *ret; - -- if (!(key_sources = open_sources_key( HKEY_CURRENT_USER ))) return NULL; -- if (!(driver_name = get_reg_value( key_sources, source ))) -+ if (is_dsn) - { -- RegCloseKey( key_sources ); -- if (!(key_sources = open_sources_key( HKEY_LOCAL_MACHINE ))) return NULL; -+ if (!(key_sources = open_sources_key( HKEY_CURRENT_USER ))) return NULL; - if (!(driver_name = get_reg_value( key_sources, source ))) - { - RegCloseKey( key_sources ); -- return NULL; -+ if (!(key_sources = open_sources_key( HKEY_LOCAL_MACHINE ))) return NULL; -+ if (!(driver_name = get_reg_value( key_sources, source ))) -+ { -+ RegCloseKey( key_sources ); -+ return NULL; -+ } - } -+ RegCloseKey( key_sources ); - } -- RegCloseKey( key_sources ); -+ else -+ driver_name = wcsdup(source); - - if (!(key_odbcinst = open_odbcinst_key()) || RegOpenKeyExW( key_odbcinst, driver_name, 0, KEY_READ, &key_driver )) - { -@@ -1175,7 +1180,7 @@ SQLRETURN WINAPI SQLConnect(SQLHDBC ConnectionHandle, SQLCHAR *ServerName, SQLSM - - if (!handle) return SQL_INVALID_HANDLE; - -- if (!servername || !(filename = get_driver_filename( servername ))) -+ if (!servername || !(filename = get_driver_filename( servername, TRUE ))) - { - WARN( "can't find driver filename\n" ); - goto done; -@@ -3983,6 +3988,35 @@ static SQLRETURN browse_connect_unix_a( struct handle *handle, SQLCHAR *in_conn_ - return ODBC_CALL( SQLBrowseConnect, ¶ms ); - } - -+static WCHAR *get_driver( const WCHAR *connection_string ) -+{ -+ const WCHAR *p = connection_string, *q; -+ WCHAR *ret = NULL; -+ unsigned int len; -+ -+ if (!p) return NULL; -+ while (*p) -+ { -+ if (!wcsnicmp( p, L"DRIVER=", 7 )) -+ { -+ p += 7; -+ if (*p == '{') -+ q = wcschr( ++p, '}' ); -+ else -+ q = wcschr( p, ';' ); -+ len = q ? (q - p) : wcslen( p ); -+ if ((ret = malloc( (len + 1) * sizeof(WCHAR) ))) -+ { -+ memcpy( ret, p, len * sizeof(WCHAR) ); -+ ret[len] = 0; -+ break; -+ } -+ } -+ p++; -+ } -+ return ret; -+} -+ - /************************************************************************* - * SQLBrowseConnect [ODBC32.055] - */ -@@ -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; -+ BOOL is_dsn = TRUE; - - TRACE("(ConnectionHandle %p, InConnectionString %s, StringLength1 %d, OutConnectionString %p, BufferLength, %d, " - "StringLength2 %p)\n", ConnectionHandle, debugstr_sqlstr(InConnectionString, StringLength1), -@@ -3999,13 +4034,16 @@ SQLRETURN WINAPI SQLBrowseConnect(SQLHDBC ConnectionHandle, SQLCHAR *InConnectio - - if (!handle) return SQL_INVALID_HANDLE; - -- /* FIXME: try DRIVER attribute if DSN is absent */ - if (!connection_string || !(datasource = get_datasource( connection_string ))) - { -- WARN( "can't find data source\n" ); -- goto done; -+ is_dsn = FALSE; -+ if (!(datasource = get_driver( connection_string ))) -+ { -+ WARN( "can't find data source\n" ); -+ goto done; -+ } - } -- if (!(filename = get_driver_filename( datasource ))) -+ if (!(filename = get_driver_filename( datasource, is_dsn ))) - { - WARN( "can't find driver filename\n" ); - goto done; -@@ -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; -+ BOOL is_dsn = TRUE; - - TRACE("(ConnectionHandle %p, WindowHandle %p, InConnectionString %s, Length %d, OutConnectionString %p," - " BufferLength %d, Length2 %p, DriverCompletion %d)\n", ConnectionHandle, WindowHandle, -@@ -5091,13 +5130,16 @@ SQLRETURN WINAPI SQLDriverConnect(SQLHDBC ConnectionHandle, SQLHWND WindowHandle - - if (!handle) return SQL_INVALID_HANDLE; - -- /* FIXME: try DRIVER attribute if DSN is absent */ - if (!connection_string || !(datasource = get_datasource( connection_string ))) - { -- WARN( "can't find data source\n" ); -- goto done; -+ is_dsn = FALSE; -+ if (!(datasource = get_driver( connection_string ))) -+ { -+ WARN( "can't find data source\n" ); -+ goto done; -+ } - } -- if (!(filename = get_driver_filename( datasource ))) -+ if (!(filename = get_driver_filename( datasource, is_dsn ))) - { - WARN( "can't find driver filename\n" ); - goto done; -@@ -5310,7 +5352,7 @@ SQLRETURN WINAPI SQLConnectW(SQLHDBC ConnectionHandle, SQLWCHAR *ServerName, SQL - - if (!handle) return SQL_INVALID_HANDLE; - -- if (!(filename = get_driver_filename( ServerName ))) -+ if (!(filename = get_driver_filename( ServerName, TRUE ))) - { - WARN( "can't find driver filename\n" ); - goto done; -@@ -6137,6 +6179,7 @@ SQLRETURN WINAPI SQLDriverConnectW(SQLHDBC ConnectionHandle, SQLHWND WindowHandl - struct handle *handle = ConnectionHandle; - WCHAR *datasource, *filename = NULL; - SQLRETURN ret = SQL_ERROR; -+ BOOL is_dsn = TRUE; - - TRACE("(ConnectionHandle %p, WindowHandle %p, InConnectionString %s, Length %d, OutConnectionString %p," - " BufferLength %d, Length2 %p, DriverCompletion %d)\n", ConnectionHandle, WindowHandle, -@@ -6145,13 +6188,16 @@ SQLRETURN WINAPI SQLDriverConnectW(SQLHDBC ConnectionHandle, SQLHWND WindowHandl - - if (!handle) return SQL_INVALID_HANDLE; - -- /* FIXME: try DRIVER attribute if DSN is absent */ - if (!(datasource = get_datasource( InConnectionString ))) - { -- WARN( "can't find data source\n" ); -- goto done; -+ is_dsn = FALSE; -+ if (!(datasource = get_driver( InConnectionString ))) -+ { -+ WARN( "can't find data source\n" ); -+ goto done; -+ } - } -- if (!(filename = get_driver_filename( datasource ))) -+ if (!(filename = get_driver_filename( datasource, is_dsn ))) - { - WARN( "can't find driver filename\n" ); - goto done; -@@ -6553,6 +6599,7 @@ SQLRETURN WINAPI SQLBrowseConnectW(SQLHDBC ConnectionHandle, SQLWCHAR *InConnect - struct handle *handle = ConnectionHandle; - WCHAR *datasource, *filename = NULL; - SQLRETURN ret = SQL_ERROR; -+ BOOL is_dsn = TRUE; - - TRACE("(ConnectionHandle %p, InConnectionString %s, StringLength1 %d, OutConnectionString %p, BufferLength %d, " - "StringLength2 %p)\n", ConnectionHandle, debugstr_sqlwstr(InConnectionString, StringLength1), StringLength1, -@@ -6560,13 +6607,16 @@ SQLRETURN WINAPI SQLBrowseConnectW(SQLHDBC ConnectionHandle, SQLWCHAR *InConnect - - if (!handle) return SQL_INVALID_HANDLE; - -- /* FIXME: try DRIVER attribute if DSN is absent */ - if (!(datasource = get_datasource( InConnectionString ))) - { -- WARN( "can't find data source\n" ); -- goto done; -+ is_dsn = FALSE; -+ if (!(datasource = get_driver( InConnectionString ))) -+ { -+ WARN( "can't find data source\n" ); -+ goto done; -+ } - } -- if (!(filename = get_driver_filename( datasource ))) -+ if (!(filename = get_driver_filename( datasource, is_dsn ))) - { - WARN( "can't find driver filename\n" ); - goto done; --- -2.43.0 - 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 f96d0abf..d94f8ace 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 6316f79675f38230ee43da7d8a993ff9cb1379f3 Mon Sep 17 00:00:00 2001 +From 8002ebd60de0c6d9eb718eb58599a41823b3d930 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 --- - dlls/odbc32/proxyodbc.c | 23 +++++++++++++++++++++++ - 1 file changed, 23 insertions(+) + dlls/odbc32/proxyodbc.c | 24 ++++++++++++++++++++++++ + 1 file changed, 24 insertions(+) diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index df8fa06dc57..cbe3e72ef35 100644 +index 4f23c761f5a..5ead68700df 100644 --- a/dlls/odbc32/proxyodbc.c +++ b/dlls/odbc32/proxyodbc.c -@@ -5686,6 +5686,21 @@ static SQLRETURN col_attribute_unix_w( struct handle *handle, SQLUSMALLINT col, +@@ -5893,6 +5893,21 @@ static SQLRETURN col_attribute_unix_w( struct statement *stmt, SQLUSMALLINT col, return ret; } @@ -30,24 +30,26 @@ index df8fa06dc57..cbe3e72ef35 100644 + } +} + - static SQLRETURN col_attribute_win32_w( struct handle *handle, SQLUSMALLINT col, SQLUSMALLINT field_id, + static SQLRETURN col_attribute_win32_w( struct statement *stmt, SQLUSMALLINT col, SQLUSMALLINT field_id, SQLPOINTER char_attr, SQLSMALLINT buflen, SQLSMALLINT *retlen, SQLLEN *num_attr ) -@@ -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 ); -+ else if(handle->win32_funcs->SQLColAttributesW) +@@ -5900,7 +5915,16 @@ static SQLRETURN col_attribute_win32_w( struct statement *stmt, SQLUSMALLINT col + if (stmt->hdr.win32_funcs->SQLColAttributeW) + return stmt->hdr.win32_funcs->SQLColAttributeW( stmt->hdr.win32_handle, col, field_id, char_attr, buflen, + retlen, num_attr ); ++ else if(stmt->hdr.win32_funcs->SQLColAttributesW) + { + /* ODBC v2 */ + field_id = map_odbc3_to_2(field_id); -+ return handle->win32_funcs->SQLColAttributesW( handle->win32_handle, col, field_id, ++ return stmt->hdr.win32_funcs->SQLColAttributesW( stmt->hdr.win32_handle, col, field_id, + char_attr, buflen, retlen, + num_attr ); + } - if (handle->win32_funcs->SQLColAttribute) FIXME( "Unicode to ANSI conversion not handled\n" ); + if (stmt->hdr.win32_funcs->SQLColAttribute) FIXME( "Unicode to ANSI conversion not handled\n" ); ++ return SQL_ERROR; } + -- 2.43.0 diff --git a/patches/odbc32-fixes/0006-odbc32-SQLGetDiagRec-W-handle-fallback-function.patch b/patches/odbc32-fixes/0006-odbc32-SQLGetDiagRec-W-handle-fallback-function.patch index 08c5ea97..eec7d4af 100644 --- a/patches/odbc32-fixes/0006-odbc32-SQLGetDiagRec-W-handle-fallback-function.patch +++ b/patches/odbc32-fixes/0006-odbc32-SQLGetDiagRec-W-handle-fallback-function.patch @@ -1,59 +1,65 @@ -From c72487ac8ae2279f43da906df6ac430fa55e2ae9 Mon Sep 17 00:00:00 2001 +From 397d95d8e50299f949ac73b0cc245f5fe66cacae Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Fri, 12 Jul 2024 14:29:17 +1000 -Subject: [PATCH 06/15] odbc32: SQLGetDiagRec/W handle fallback function +Subject: [PATCH] odbc32: SQLGetDiagRec/W handle fallback function --- - dlls/odbc32/proxyodbc.c | 29 ++++++++++++++++++++++++++++- - 1 file changed, 28 insertions(+), 1 deletion(-) + dlls/odbc32/proxyodbc.c | 34 +++++++++++++++++++++++++++++++--- + 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index 1f51ac2a27e..c4e1c046edc 100644 +index 5ead68700df..97c4cac8e31 100644 --- a/dlls/odbc32/proxyodbc.c +++ b/dlls/odbc32/proxyodbc.c -@@ -1915,7 +1915,21 @@ SQLRETURN WINAPI SQLGetDiagRec(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMAL +@@ -2672,7 +2672,21 @@ SQLRETURN WINAPI SQLGetDiagRec(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMAL } - else if (handle->win32_handle) + else if (obj->win32_handle) { -- ret = get_diag_rec_win32_a( HandleType, handle, RecNumber, SqlState, NativeError, MessageText, BufferLength, +- ret = get_diag_rec_win32_a( HandleType, obj, RecNumber, SqlState, NativeError, MessageText, BufferLength, + /* ODBC v2.0 */ -+ if (handle->win32_funcs->SQLError) ++ if (obj->win32_funcs->SQLError) + { + if (HandleType == SQL_HANDLE_ENV) -+ ret = handle->win32_funcs->SQLError(handle->win32_handle, SQL_NULL_HDBC, SQL_NULL_HSTMT, ++ ret = obj->win32_funcs->SQLError(obj->win32_handle, SQL_NULL_HDBC, SQL_NULL_HSTMT, + SqlState, NativeError, MessageText, BufferLength, TextLength); + else if (HandleType == SQL_HANDLE_DBC) -+ ret = handle->win32_funcs->SQLError(SQL_NULL_HENV, handle->win32_handle, SQL_NULL_HSTMT, ++ ret = obj->win32_funcs->SQLError(SQL_NULL_HENV, obj->win32_handle, SQL_NULL_HSTMT, + SqlState, NativeError, MessageText, BufferLength, TextLength); + else if (HandleType == SQL_HANDLE_STMT) -+ ret = handle->win32_funcs->SQLError(SQL_NULL_HENV, SQL_NULL_HDBC, handle->win32_handle, ++ ret = obj->win32_funcs->SQLError(SQL_NULL_HENV, SQL_NULL_HDBC, obj->win32_handle, + SqlState, NativeError, MessageText, BufferLength, TextLength); + } + else -+ ret = get_diag_rec_win32_a( HandleType, handle, RecNumber, SqlState, NativeError, MessageText, BufferLength, ++ ret = get_diag_rec_win32_a( HandleType, obj, RecNumber, SqlState, NativeError, MessageText, BufferLength, TextLength ); } -@@ -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 ); -+ else if (handle->win32_funcs->SQLErrorW) +@@ -6187,9 +6201,23 @@ static SQLRETURN get_diag_rec_win32_w( SQLSMALLINT type, struct object *obj, SQL + SQLSMALLINT *retlen ) + { + if (obj->win32_funcs->SQLGetDiagRecW) +- return obj->win32_funcs->SQLGetDiagRecW( type, obj->win32_handle, rec_num, state, native_err, msg, buflen, +- retlen ); ++ return obj->win32_funcs->SQLGetDiagRecW( type, obj->win32_handle, rec_num, state, native_err, ++ msg, buflen, retlen ); ++ else if (obj->win32_funcs->SQLErrorW) + { + /* ODBC v2 */ -+ if (handle_type == SQL_HANDLE_ENV) -+ return handle->win32_funcs->SQLErrorW(handle->win32_handle, SQL_NULL_HDBC, SQL_NULL_HSTMT, ++ if (type == SQL_HANDLE_ENV) ++ return obj->win32_funcs->SQLErrorW(obj->win32_handle, SQL_NULL_HDBC, SQL_NULL_HSTMT, + state, native_err, msg, buflen, retlen); -+ else if (handle_type == SQL_HANDLE_DBC) -+ return handle->win32_funcs->SQLErrorW(SQL_NULL_HENV, handle->win32_handle, SQL_NULL_HSTMT, ++ else if (type == SQL_HANDLE_DBC) ++ return obj->win32_funcs->SQLErrorW(SQL_NULL_HENV, obj->win32_handle, SQL_NULL_HSTMT, + state, native_err, msg, buflen, retlen); -+ else if (handle_type == SQL_HANDLE_STMT) -+ return handle->win32_funcs->SQLErrorW(SQL_NULL_HENV, SQL_NULL_HDBC, handle->win32_handle, ++ else if (type == SQL_HANDLE_STMT) ++ return obj->win32_funcs->SQLErrorW(SQL_NULL_HENV, SQL_NULL_HDBC, obj->win32_handle, + state, native_err, msg, buflen, retlen); + } - if (handle->win32_funcs->SQLGetDiagRec) FIXME( "Unicode to ANSI conversion not handled\n" ); + if (obj->win32_funcs->SQLGetDiagRec) FIXME( "Unicode to ANSI conversion not handled\n" ); ++ return SQL_ERROR; } + -- 2.43.0 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 d9468e71..4f715015 100644 --- a/patches/odbc32-fixes/0008-odbc32-SQLBindParameter-handle-fallback-function.patch +++ b/patches/odbc32-fixes/0008-odbc32-SQLBindParameter-handle-fallback-function.patch @@ -1,21 +1,21 @@ -From 83238653f67745cd9316b6140fc32a424ffa9b1b Mon Sep 17 00:00:00 2001 +From 1b2068b8f8adc036d0c2b9cda00c37cd55330b41 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 --- - dlls/odbc32/proxyodbc.c | 22 ++++++++++++++++++++++ - 1 file changed, 22 insertions(+) + dlls/odbc32/proxyodbc.c | 23 +++++++++++++++++++++++ + 1 file changed, 23 insertions(+) diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index 557cd212425..7105f3534ce 100644 +index 8f53fa71668..7099027c2b4 100644 --- a/dlls/odbc32/proxyodbc.c +++ b/dlls/odbc32/proxyodbc.c -@@ -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) +@@ -5242,6 +5242,29 @@ static SQLRETURN bind_parameter_win32( struct statement *stmt, SQLUSMALLINT para + if (stmt->hdr.win32_funcs->SQLBindParameter) + return stmt->hdr.win32_funcs->SQLBindParameter( stmt->hdr.win32_handle, param, io_type, value_type, + param_type, size, digits, value, buflen, len ); ++ else if(stmt->hdr.win32_funcs->SQLBindParam) + { + /* ODBC v2 */ + /* TODO: Make function */ @@ -34,9 +34,10 @@ index 557cd212425..7105f3534ce 100644 + else if (param_type == SQL_TIMESTAMP) + param_type = SQL_TYPE_TIMESTAMP;;; + -+ return handle->win32_funcs->SQLBindParam(handle->win32_handle, param, value_type, param_type, ++ return stmt->hdr.win32_funcs->SQLBindParam( stmt->hdr.win32_handle, param, value_type, param_type, + size, digits, value, len); + } ++ return SQL_ERROR; } 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 17db58e0..bbadc69f 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,4 +1,4 @@ -From 20374d93364244b20dc9c87b53c40c375d4f1235 Mon Sep 17 00:00:00 2001 +From 1b5f6b996f8a1f314e935657f5e205717ace23b4 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 @@ -8,17 +8,17 @@ Subject: [PATCH] odbc32: SQLSetConnectAttr/W handle fallback function 1 file changed, 5 insertions(+) diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index 7105f3534ce..dd94e070796 100644 +index 7099027c2b4..632738b9533 100644 --- a/dlls/odbc32/proxyodbc.c +++ b/dlls/odbc32/proxyodbc.c -@@ -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) +@@ -6334,6 +6334,11 @@ static SQLRETURN set_connect_attr_win32_w( struct connection *con, SQLINTEGER at + if (con->hdr.win32_funcs->SQLSetConnectAttrW) + return con->hdr.win32_funcs->SQLSetConnectAttrW( con->hdr.win32_handle, attr, value, len ); + if (con->hdr.win32_funcs->SQLSetConnectAttr) FIXME( "Unicode to ANSI conversion not handled\n" ); ++ else if(con->hdr.win32_funcs->SQLSetConnectOptionW) + { + /* ODBC v2 */ -+ return handle->win32_funcs->SQLSetConnectOptionW( handle->win32_handle, attr, (SQLULEN)value ); ++ return con->hdr.win32_funcs->SQLSetConnectOptionW( con->hdr.win32_handle, attr, (SQLULEN)value ); + } return SQL_ERROR; } 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 4eca2b78..056301b9 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,87 +1,45 @@ -From d92d2f9dab7aa9552dbed099a3f07182c8bad185 Mon Sep 17 00:00:00 2001 +From 53c9ccb1d5008cf348268e6a053ff6414bc4773e 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. --- - dlls/odbc32/proxyodbc.c | 34 +++++++++++++++++++++++++++++++++- - dlls/odbc32/unixlib.h | 11 +++++++++++ - 2 files changed, 44 insertions(+), 1 deletion(-) + dlls/odbc32/proxyodbc.c | 22 +++++++++++++++++++++- + 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index dd94e070796..7120f24b76b 100644 +index 632738b9533..ca598e404b1 100644 --- a/dlls/odbc32/proxyodbc.c +++ b/dlls/odbc32/proxyodbc.c -@@ -6105,7 +6105,39 @@ SQLRETURN WINAPI SQLGetStmtAttrW(SQLHSTMT StatementHandle, SQLINTEGER Attribute, +@@ -6315,7 +6315,27 @@ SQLRETURN WINAPI SQLGetStmtAttrW(SQLHSTMT StatementHandle, SQLINTEGER Attribute, } - else if (handle->win32_handle) + else if (stmt->hdr.win32_handle) { -- ret = get_stmt_attr_win32_w( handle, Attribute, Value, BufferLength, StringLength ); -+ switch(Attribute) +- ret = get_stmt_attr_win32_w( stmt, Attribute, Value, BufferLength, StringLength ); ++ switch(Attribute) + { + case SQL_ATTR_APP_ROW_DESC: -+ handle->app_row_desc.parent = handle; -+ ret = handle->win32_funcs->SQLGetStmtAttrW( handle->win32_handle, Attribute, -+ &handle->app_row_desc.driver_hdesc, -+ BufferLength, StringLength); -+ *((SQLHDESC*)Value) = &handle->app_row_desc; -+ break; + case SQL_ATTR_IMP_ROW_DESC: -+ handle->imp_row_desc.parent = handle; -+ ret = handle->win32_funcs->SQLGetStmtAttrW( handle->win32_handle, Attribute, -+ &handle->imp_row_desc.driver_hdesc, -+ BufferLength, StringLength); -+ *((SQLHDESC*)Value) = &handle->imp_row_desc; -+ break; + case SQL_ATTR_APP_PARAM_DESC: -+ handle->app_param_desc.parent = handle; -+ ret = handle->win32_funcs->SQLGetStmtAttrW( handle->win32_handle, Attribute, -+ &handle->app_param_desc.driver_hdesc, -+ BufferLength, StringLength); -+ *((SQLHDESC*)Value) = &handle->app_param_desc; -+ break; + case SQL_ATTR_IMP_PARAM_DESC: -+ handle->imp_param_desc.parent = handle; -+ ret = handle->win32_funcs->SQLGetStmtAttrW( handle->win32_handle, Attribute, -+ &handle->imp_param_desc.driver_hdesc, ++ { ++ struct descriptor *desc; ++ if ((desc = create_descriptor( stmt ))) ++ { ++ ret = stmt->hdr.win32_funcs->SQLGetStmtAttrW( stmt->hdr.win32_handle, Attribute, ++ &desc->hdr.win32_handle, + BufferLength, StringLength); -+ *((SQLHDESC*)Value) = &handle->imp_param_desc; ++ desc->hdr.win32_funcs = stmt->hdr.win32_funcs; ++ *((SQLHDESC*)Value) = desc; ++ } + break; ++ } + default: -+ ret = get_stmt_attr_win32_w( handle, Attribute, Value, BufferLength, StringLength ); ++ ret = get_stmt_attr_win32_w( stmt, Attribute, Value, BufferLength, StringLength ); + } } TRACE("Returning %d\n", ret); -diff --git a/dlls/odbc32/unixlib.h b/dlls/odbc32/unixlib.h -index 4241d06c892..fc69857c8b7 100644 ---- a/dlls/odbc32/unixlib.h -+++ b/dlls/odbc32/unixlib.h -@@ -183,6 +183,12 @@ struct param_binding - struct param *param; - }; - -+struct SQLHDESC_data -+{ -+ struct handle *parent; -+ SQLHDESC driver_hdesc; -+}; -+ - struct handle - { - /* handles */ -@@ -194,6 +200,11 @@ struct handle - UINT32 env_attr_version; - UINT32 con_attr_con_timeout; - UINT32 con_attr_login_timeout; -+ /* statement parameters */ -+ struct SQLHDESC_data app_row_desc; -+ struct SQLHDESC_data imp_row_desc; -+ struct SQLHDESC_data app_param_desc; -+ struct SQLHDESC_data imp_param_desc; - /* drivers and data sources */ - UINT32 drivers_idx; - void *drivers_key; -- 2.43.0 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 deleted file mode 100644 index 293782f0..00000000 --- a/patches/odbc32-fixes/0011-odbc32-SQLSetDescFieldW-pass-correct-handle-onto-dri.patch +++ /dev/null @@ -1,48 +0,0 @@ -From cee76bad632261533d15e6d642367fbb66176564 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 - ---- - 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 7120f24b76b..ddf6c0ac9f5 100644 ---- a/dlls/odbc32/proxyodbc.c -+++ b/dlls/odbc32/proxyodbc.c -@@ -6086,7 +6086,7 @@ SQLRETURN WINAPI SQLGetStmtAttrW(SQLHSTMT StatementHandle, SQLINTEGER Attribute, - SQLINTEGER BufferLength, SQLINTEGER *StringLength) - { - struct handle *handle = StatementHandle; -- SQLRETURN ret = SQL_ERROR; -+ SQLRETURN ret = SQL_SUCCESS; - - TRACE("(StatementHandle %p, Attribute %d, Value %p, BufferLength %d, StringLength %p)\n", StatementHandle, - Attribute, Value, BufferLength, StringLength); -@@ -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) - { -- struct handle *handle = DescriptorHandle; -+ struct SQLHDESC_data *hdesc = DescriptorHandle; -+ struct handle *handle = hdesc->parent; - SQLRETURN ret = SQL_ERROR; - - TRACE("(DescriptorHandle %p, RecNumber %d, FieldIdentifier %d, Value %p, BufferLength %d)\n", DescriptorHandle, -@@ -7282,7 +7283,11 @@ SQLRETURN WINAPI SQLSetDescFieldW(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumb - } - else if (handle->win32_handle) - { -- 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 = set_desc_field_win32_w( handle, RecNumber, FieldIdentifier, Value, BufferLength ); - } - - TRACE("Returning %d\n", ret); --- -2.43.0 - diff --git a/patches/odbc32-fixes/0012-odbc32-Record-loaded-driver-SQL_ATTR_ODBC_VERSION.patch b/patches/odbc32-fixes/0012-odbc32-Record-loaded-driver-SQL_ATTR_ODBC_VERSION.patch index ed276e19..5f9aac44 100644 --- a/patches/odbc32-fixes/0012-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 826649e599a8e8c68b468771aded099c659c0e72 Mon Sep 17 00:00:00 2001 +From 02836ce54a6a32a72cc696f783f6241da23fa385 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Thu, 18 Jul 2024 07:13:48 +1000 -Subject: [PATCH 12/15] odbc32: Record loaded driver SQL_ATTR_ODBC_VERSION +Subject: [PATCH] odbc32: Record loaded driver SQL_ATTR_ODBC_VERSION --- dlls/odbc32/proxyodbc.c | 4 ++++ @@ -9,39 +9,39 @@ Subject: [PATCH 12/15] 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 c70b0d80012..bb1cae25051 100644 +index d48c3d822fa..1977e766950 100644 --- a/dlls/odbc32/proxyodbc.c +++ b/dlls/odbc32/proxyodbc.c -@@ -376,6 +376,7 @@ static struct handle *create_handle( struct handle *parent ) +@@ -463,6 +463,7 @@ static struct environment *create_environment( void ) if (!(ret = calloc( 1, sizeof(*ret) ))) return NULL; - ret->parent = parent; - ret->env_attr_version = SQL_OV_ODBC2; + init_object( &ret->hdr, SQL_HANDLE_ENV, NULL ); + ret->attr_version = SQL_OV_ODBC2; + ret->driver_ver = SQL_OV_ODBC2; - ret->row_count = 1; return ret; } -@@ -891,6 +892,9 @@ static SQLRETURN set_env_attr( struct handle *handle, SQLINTEGER attr, SQLPOINTE + +@@ -1173,6 +1174,9 @@ static SQLRETURN set_env_attr( struct environment *env, SQLINTEGER attr, SQLPOIN } - else if (handle->win32_handle) + else if (env->hdr.win32_handle) { -+ if (handle->win32_funcs->SQLGetEnvAttr) -+ ret = handle->win32_funcs->SQLGetEnvAttr( handle->win32_handle, SQL_ATTR_ODBC_VERSION, &handle->driver_ver, 0, NULL ); ++ if (env->hdr.win32_funcs->SQLGetEnvAttr) ++ ret = env->hdr.win32_funcs->SQLGetEnvAttr( env->hdr.win32_handle, SQL_ATTR_ODBC_VERSION, &env->driver_ver, 0, NULL ); + - if (handle->win32_funcs->SQLSetEnvAttr) - ret = handle->win32_funcs->SQLSetEnvAttr( handle->win32_handle, attr, value, len ); + if (env->hdr.win32_funcs->SQLSetEnvAttr) + ret = env->hdr.win32_funcs->SQLSetEnvAttr( env->hdr.win32_handle, attr, value, len ); } diff --git a/dlls/odbc32/unixlib.h b/dlls/odbc32/unixlib.h -index fc69857c8b7..61b8429768d 100644 +index c771e16f9e3..05ee89c57db 100644 --- a/dlls/odbc32/unixlib.h +++ b/dlls/odbc32/unixlib.h -@@ -211,6 +211,7 @@ struct handle +@@ -211,6 +211,7 @@ struct environment UINT32 sources_idx; void *sources_key; BOOL sources_system; + UINT32 driver_ver; - /* parameter bindings */ - struct param_binding bind_col; - struct param_binding bind_parameter; + }; + + struct connection -- 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 6759da83..aefe28f8 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,4 +1,4 @@ -From 37a034464df09450fe1d4226bf43ca7588c7894d Mon Sep 17 00:00:00 2001 +From ad0e5c8a6edd8f483ad3b2cd389b6ec5519b3891 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 @@ -8,15 +8,15 @@ Subject: [PATCH] odbc32: SQLGetData support ODBC v2.0 1 file changed, 13 insertions(+) diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index be20e967aea..1836164796f 100644 +index 1977e766950..b2bf2a7d58c 100644 --- a/dlls/odbc32/proxyodbc.c +++ b/dlls/odbc32/proxyodbc.c -@@ -2223,7 +2223,20 @@ static SQLRETURN get_data_win32( struct handle *handle, SQLUSMALLINT column, SQL +@@ -2368,7 +2368,20 @@ static SQLRETURN get_data_win32( struct statement *stmt, SQLUSMALLINT column, SQ SQLLEN buflen, SQLLEN *retlen ) { - if (handle->win32_funcs->SQLGetData) + if (stmt->hdr.win32_funcs->SQLGetData) + { -+ if (handle->env_attr_version == SQL_OV_ODBC2) ++ if ( ((struct environment*)(stmt->hdr.parent))->attr_version == SQL_OV_ODBC2) + { + if (type == SQL_C_TYPE_TIME) + type = SQL_C_TIME; @@ -26,7 +26,7 @@ index be20e967aea..1836164796f 100644 + type = SQL_C_TIMESTAMP; + } + - return handle->win32_funcs->SQLGetData( handle->win32_handle, column, type, value, buflen, retlen ); + return stmt->hdr.win32_funcs->SQLGetData( stmt->hdr.win32_handle, column, type, value, buflen, retlen ); + } + return SQL_ERROR; 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 index 4b4b7fc8..f313fcc5 100644 --- a/patches/odbc32-fixes/0014-odbc32-SQLColAttributesW-support-ODBC-v2.0.patch +++ b/patches/odbc32-fixes/0014-odbc32-SQLColAttributesW-support-ODBC-v2.0.patch @@ -1,32 +1,34 @@ -From c41312e28ac2c500aad9e5cdbbbee4670f4b4a86 Mon Sep 17 00:00:00 2001 +From 7fd12044418fbd610b920961db964ff0acd098f4 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 +Subject: [PATCH] odbc32: SQLColAttributesW support ODBC v2.0 --- - dlls/odbc32/proxyodbc.c | 18 +++++++++++++++++- - 1 file changed, 17 insertions(+), 1 deletion(-) + dlls/odbc32/proxyodbc.c | 22 +++++++++++++++++++--- + 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index a66ec99b913..a9d23c94504 100644 +index b2bf2a7d58c..f7a6535db37 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) +@@ -5973,11 +5973,27 @@ static SQLRETURN col_attribute_win32_w( struct statement *stmt, SQLUSMALLINT col + retlen, num_attr ); + else if(stmt->hdr.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 ); +- return stmt->hdr.win32_funcs->SQLColAttributesW( stmt->hdr.win32_handle, col, field_id, +- char_attr, buflen, retlen, +- num_attr ); ++ ret = stmt->hdr.win32_funcs->SQLColAttributesW( stmt->hdr.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_ODBC2) ++ ((struct environment*)(stmt->hdr.parent))->attr_version == SQL_OV_ODBC2 && ++ ((struct environment*)(stmt->hdr.parent))->driver_ver == SQL_OV_ODBC2) + { + if (*num_attr == SQL_TIME) + *num_attr = SQL_TYPE_TIME; @@ -38,8 +40,8 @@ index a66ec99b913..a9d23c94504 100644 + + return ret; } - if (handle->win32_funcs->SQLColAttribute) FIXME( "Unicode to ANSI conversion not handled\n" ); - return SQL_ERROR; + if (stmt->hdr.win32_funcs->SQLColAttribute) FIXME( "Unicode to ANSI conversion not handled\n" ); + -- 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 4351d9ec..733236f2 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,4 +1,4 @@ -From b86180b88e1d485bb628a195e2315be2bada2898 Mon Sep 17 00:00:00 2001 +From 2003987040ac9ac13d899c299b1375024a18a1dc 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 @@ -8,17 +8,17 @@ Subject: [PATCH] odbc32: SQLSetStmtAttrW support fallback for ODBC v2.0 1 file changed, 5 insertions(+) diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index 3429e8a26ce..2464ddfebee 100644 +index f7a6535db37..d0661406fae 100644 --- a/dlls/odbc32/proxyodbc.c +++ b/dlls/odbc32/proxyodbc.c -@@ -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) +@@ -7585,6 +7585,11 @@ static SQLRETURN set_stmt_attr_win32_w( struct statement *stmt, SQLINTEGER attr, + if (stmt->hdr.win32_funcs->SQLSetStmtAttrW) + return stmt->hdr.win32_funcs->SQLSetStmtAttrW( stmt->hdr.win32_handle, attr, value, len ); + if (stmt->hdr.win32_funcs->SQLSetStmtAttr) FIXME( "Unicode to ANSI conversion not handled\n" ); ++ else if (stmt->hdr.win32_funcs->SQLSetStmtOption) + { + /* ODBC v2.0 */ -+ return handle->win32_funcs->SQLSetStmtOption( handle->win32_handle, attr, (SQLULEN)value ); ++ return stmt->hdr.win32_funcs->SQLSetStmtOption( stmt->hdr.win32_handle, attr, (SQLULEN)value ); + } return SQL_ERROR; } diff --git a/patches/odbc32-fixes/0016-odbc32-set_con_attr-return-success-by-default.patch b/patches/odbc32-fixes/0016-odbc32-set_con_attr-return-success-by-default.patch index ac0090a0..a9a01918 100644 --- a/patches/odbc32-fixes/0016-odbc32-set_con_attr-return-success-by-default.patch +++ b/patches/odbc32-fixes/0016-odbc32-set_con_attr-return-success-by-default.patch @@ -1,4 +1,4 @@ -From a286fe2aca1bd8f7c2a95675394fe554d16ef7fa Mon Sep 17 00:00:00 2001 +From bf50a23bd4bd098a51b4944f1c22a9d2a71fc454 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Sat, 20 Jul 2024 12:56:26 +1000 Subject: [PATCH] odbc32: set_con_attr return success by default @@ -8,25 +8,25 @@ Subject: [PATCH] odbc32: set_con_attr return success by default 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index dee73f0618e..d29069cb021 100644 +index d0661406fae..cf13669d051 100644 --- a/dlls/odbc32/proxyodbc.c +++ b/dlls/odbc32/proxyodbc.c -@@ -994,7 +994,7 @@ static SQLRETURN create_env( struct handle *handle, BOOL is_unix ) +@@ -1219,7 +1219,7 @@ static SQLRETURN create_env( struct environment *env, BOOL is_unix ) - static SQLRETURN set_con_attr( struct handle *handle, SQLINTEGER attr, SQLPOINTER value, SQLINTEGER len ) + static SQLRETURN set_con_attr( struct connection *con, SQLINTEGER attr, SQLPOINTER value, SQLINTEGER len ) { - SQLRETURN ret = SQL_ERROR; + SQLRETURN ret = SQL_SUCCESS; - if (handle->unix_handle) + if (con->hdr.unix_handle) { -@@ -1017,6 +1017,17 @@ static SQLRETURN set_con_attr( struct handle *handle, SQLINTEGER attr, SQLPOINTE - ret = handle->win32_funcs->SQLSetConnectAttrW( handle->win32_handle, attr, value, len ); - else if (handle->win32_funcs->SQLSetConnectAttr) - ret = handle->win32_funcs->SQLSetConnectAttr( handle->win32_handle, attr, value, len ); -+ else if (handle->win32_funcs->SQLSetConnectOptionW) +@@ -1242,6 +1242,17 @@ static SQLRETURN set_con_attr( struct connection *con, SQLINTEGER attr, SQLPOINT + ret = con->hdr.win32_funcs->SQLSetConnectAttrW( con->hdr.win32_handle, attr, value, len ); + else if (con->hdr.win32_funcs->SQLSetConnectAttr) + ret = con->hdr.win32_funcs->SQLSetConnectAttr( con->hdr.win32_handle, attr, value, len ); ++ else if (con->hdr.win32_funcs->SQLSetConnectOptionW) + { -+ ret = handle->win32_funcs->SQLSetConnectOptionW( handle->win32_handle, attr, (SQLULEN)value ); ++ ret = con->hdr.win32_funcs->SQLSetConnectOptionW( con->hdr.win32_handle, attr, (SQLULEN)value ); + + /* If an option isn't supported on other driver, then just return success for now. */ + if(ret != SQL_SUCCESS) @@ -36,8 +36,8 @@ index dee73f0618e..d29069cb021 100644 + } + } } + return 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 deleted file mode 100644 index 7d1d8094..00000000 --- a/patches/odbc32-fixes/0017-odbc32-Use-SQLAllocHandle-to-allocated-a-STMT-handle.patch +++ /dev/null @@ -1,38 +0,0 @@ -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 deleted file mode 100644 index aa1bf84b..00000000 --- a/patches/odbc32-fixes/0018-odbc32-Call-drivers-SQLBindCol-function.patch +++ /dev/null @@ -1,25 +0,0 @@ -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/patches/printdlg-properties_btn/0001-printdlg-Allow-button-id-psh1-for-Properties-button.patch b/patches/printdlg-properties_btn/0001-printdlg-Allow-button-id-psh1-for-Properties-button.patch deleted file mode 100644 index eaf96612..00000000 --- a/patches/printdlg-properties_btn/0001-printdlg-Allow-button-id-psh1-for-Properties-button.patch +++ /dev/null @@ -1,33 +0,0 @@ -From e93b8d3f2fe126cc42c4af3f6784f268de5d94f2 Mon Sep 17 00:00:00 2001 -From: Fabian Maurer -Date: Fri, 19 Jul 2024 00:06:37 +0200 -Subject: [PATCH] printdlg: Allow button id psh1 for "Properties" button. - -Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55841 ---- - dlls/comdlg32/printdlg.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/dlls/comdlg32/printdlg.c b/dlls/comdlg32/printdlg.c -index aed486a9b09..b5c67c3abad 100644 ---- a/dlls/comdlg32/printdlg.c -+++ b/dlls/comdlg32/printdlg.c -@@ -1796,6 +1796,7 @@ static LRESULT PRINTDLG_WMCommandA(HWND hDlg, WPARAM wParam, - } - break; - -+ case psh1: /* Setup button */ - case psh2: /* Properties button */ - { - HANDLE hPrinter; -@@ -1952,6 +1953,7 @@ static LRESULT PRINTDLG_WMCommandW(HWND hDlg, WPARAM wParam, - } - break; - -+ case psh1: /* Setup button */ - case psh2: /* Properties button */ - { - HANDLE hPrinter; --- -2.43.0 - diff --git a/patches/printdlg-properties_btn/definition b/patches/printdlg-properties_btn/definition deleted file mode 100644 index 2c707207..00000000 --- a/patches/printdlg-properties_btn/definition +++ /dev/null @@ -1,3 +0,0 @@ -Fixes: [55841] Support print "Properties" button. - -# PR 6119 diff --git a/staging/upstream-commit b/staging/upstream-commit index 2a33ec11..c71c6f91 100644 --- a/staging/upstream-commit +++ b/staging/upstream-commit @@ -1 +1 @@ -ad8b2870312a373fb0ab0ff2cbf6d42b3f08c15a +d98f067294918aa5cfeadb576652dd8fd1757c38