From eff3de6ad260f327453e94e37d89205e94efe33c Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Wed, 30 Apr 2025 14:00:32 +1000 Subject: [PATCH] Updated odbc32-fixes patchset --- ...2-SQLGetInfoW-support-ascii-fallback.patch | 75 ++++++++++++++----- .../0025-odbc32-Various-ascii-fallback.patch | 19 ----- ...olAttributesW-support-ascii-fallback.patch | 26 ++++--- ...-SQLColAttributeW-Add-ascii-fallback.patch | 70 +++++++++++++++++ 4 files changed, 144 insertions(+), 46 deletions(-) create mode 100644 patches/odbc32-fixes/0027-odbc32-SQLColAttributeW-Add-ascii-fallback.patch diff --git a/patches/odbc32-fixes/0020-odbc32-SQLGetInfoW-support-ascii-fallback.patch b/patches/odbc32-fixes/0020-odbc32-SQLGetInfoW-support-ascii-fallback.patch index 8a16d678..b78af175 100644 --- a/patches/odbc32-fixes/0020-odbc32-SQLGetInfoW-support-ascii-fallback.patch +++ b/patches/odbc32-fixes/0020-odbc32-SQLGetInfoW-support-ascii-fallback.patch @@ -1,17 +1,17 @@ -From 9b36b65dd25db374f53f51cc24b36637e80de2c2 Mon Sep 17 00:00:00 2001 +From 53904cea4cd192552ab26c247593c91ca0b81993 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Sat, 26 Apr 2025 16:27:58 +1000 Subject: [PATCH] odbc32: SQLGetInfoW support ascii fallback. --- - dlls/odbc32/proxyodbc.c | 31 +++++++++++++++++++++++++++++-- - 1 file changed, 29 insertions(+), 2 deletions(-) + dlls/odbc32/proxyodbc.c | 72 +++++++++++++++++++++++++++++++++++++++-- + 1 file changed, 70 insertions(+), 2 deletions(-) diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index 7025a141bb6..495bf2ff446 100644 +index d11b4122776..cc7b9309562 100644 --- a/dlls/odbc32/proxyodbc.c +++ b/dlls/odbc32/proxyodbc.c -@@ -6924,13 +6924,40 @@ static SQLRETURN get_info_unix_w( struct connection *con, SQLUSMALLINT type, SQL +@@ -6924,13 +6924,81 @@ static SQLRETURN get_info_unix_w( struct connection *con, SQLUSMALLINT type, SQL return ODBC_CALL( SQLGetInfoW, ¶ms ); } @@ -19,14 +19,47 @@ index 7025a141bb6..495bf2ff446 100644 +{ + switch (type) + { -+ case SQL_DRIVER_ODBC_VER: -+ case SQL_DRIVER_NAME: -+ return TRUE; -+ default: -+ { -+ FIXME("Type %d not handled\n", type); -+ return FALSE; -+ } ++ case SQL_ACCESSIBLE_PROCEDURES: ++ case SQL_ACCESSIBLE_TABLES: ++ case SQL_CATALOG_NAME: ++ case SQL_CATALOG_NAME_SEPARATOR: ++ case SQL_CATALOG_TERM: ++ case SQL_COLLATION_SEQ: ++ case SQL_COLUMN_ALIAS: ++ case SQL_DATA_SOURCE_NAME: ++ case SQL_DATA_SOURCE_READ_ONLY: ++ case SQL_DATABASE_NAME: ++ case SQL_DBMS_NAME: ++ case SQL_DBMS_VER: ++ case SQL_DESCRIBE_PARAMETER: ++ case SQL_DRIVER_NAME: ++ case SQL_DRIVER_ODBC_VER: ++ case SQL_DRIVER_VER: ++ case SQL_ODBC_VER: ++ case SQL_EXPRESSIONS_IN_ORDERBY: ++ case SQL_IDENTIFIER_QUOTE_CHAR: ++ case SQL_INTEGRITY: ++ case SQL_KEYWORDS: ++ case SQL_LIKE_ESCAPE_CLAUSE: ++ case SQL_MAX_ROW_SIZE_INCLUDES_LONG: ++ case SQL_MULT_RESULT_SETS: ++ case SQL_MULTIPLE_ACTIVE_TXN: ++ case SQL_NEED_LONG_DATA_LEN: ++ case SQL_ORDER_BY_COLUMNS_IN_SELECT: ++ case SQL_PROCEDURE_TERM: ++ case SQL_PROCEDURES: ++ case SQL_ROW_UPDATES: ++ case SQL_SCHEMA_TERM: ++ case SQL_SEARCH_PATTERN_ESCAPE: ++ case SQL_SERVER_NAME: ++ case SQL_SPECIAL_CHARACTERS: ++ case SQL_TABLE_TERM: ++ case SQL_USER_NAME: ++ case SQL_XOPEN_CLI_YEAR: ++ case SQL_OUTER_JOINS: ++ return TRUE; ++ default: ++ return FALSE; + } +} + @@ -42,12 +75,20 @@ index 7025a141bb6..495bf2ff446 100644 + if (con->hdr.win32_funcs->SQLGetInfo) + { + ret = con->hdr.win32_funcs->SQLGetInfo( con->hdr.win32_handle, type, value, buflen, retlen ); -+ FIXME("st %s\n", debugstr_a(value)); + if (SQL_SUCCEEDED(ret) && typeinfo_is_string(type)) + { -+ WCHAR *p = strnAtoW(value, buflen); -+ wcscpy(value, p); -+ free(p); ++ if (value) ++ { ++ WCHAR *p = strnAtoW(value, -1); ++ wcscpy(value, p); ++ free(p); ++ ++ if (retlen) ++ *retlen = wcslen(value) * sizeof(WCHAR); ++ } ++ ++ if (retlen) ++ *retlen = *retlen * sizeof(WCHAR); + } + } + return ret; diff --git a/patches/odbc32-fixes/0025-odbc32-Various-ascii-fallback.patch b/patches/odbc32-fixes/0025-odbc32-Various-ascii-fallback.patch index fe68611b..87cdfd9a 100644 --- a/patches/odbc32-fixes/0025-odbc32-Various-ascii-fallback.patch +++ b/patches/odbc32-fixes/0025-odbc32-Various-ascii-fallback.patch @@ -56,25 +56,6 @@ index 81f5cb9a799..e965a86bf15 100644 else if(con->hdr.win32_funcs->SQLSetConnectOptionW) { /* ODBC v2 */ -@@ -7066,10 +7083,17 @@ static BOOL typeinfo_is_string( SQLSMALLINT type ) - { - case SQL_DRIVER_ODBC_VER: - case SQL_DRIVER_NAME: -+ case SQL_MULT_RESULT_SETS: -+ case SQL_NEED_LONG_DATA_LEN: - return TRUE; - default: -- { - FIXME("Type %d not handled\n", type); -+ case SQL_BOOKMARK_PERSISTENCE: -+ case SQL_LOCK_TYPES: -+ case SQL_POS_OPERATIONS: -+ case SQL_SCROLL_OPTIONS: -+ case SQL_STATIC_SENSITIVITY: -+ { - return FALSE; - } - } @@ -7978,7 +8002,13 @@ static SQLRETURN set_desc_field_win32_w( struct descriptor *desc, SQLSMALLINT re { if (desc->hdr.win32_funcs->SQLSetDescFieldW) diff --git a/patches/odbc32-fixes/0026-odbc32-SQLColAttributesW-support-ascii-fallback.patch b/patches/odbc32-fixes/0026-odbc32-SQLColAttributesW-support-ascii-fallback.patch index 4467a8fb..fecd4372 100644 --- a/patches/odbc32-fixes/0026-odbc32-SQLColAttributesW-support-ascii-fallback.patch +++ b/patches/odbc32-fixes/0026-odbc32-SQLColAttributesW-support-ascii-fallback.patch @@ -1,14 +1,14 @@ -From 0fd8102e0967e53191b27a00bb9a1f3d8cfe9f7c Mon Sep 17 00:00:00 2001 +From 085539732d3dcd3aadfda4fc022de8f33be1e509 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Mon, 28 Apr 2025 10:54:55 +1000 Subject: [PATCH] odbc32: SQLColAttributesW support ascii fallback --- - dlls/odbc32/proxyodbc.c | 36 +++++++++++++++++++++++++++++++++--- - 1 file changed, 33 insertions(+), 3 deletions(-) + dlls/odbc32/proxyodbc.c | 42 ++++++++++++++++++++++++++++++++++++++--- + 1 file changed, 39 insertions(+), 3 deletions(-) diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index db6ce0f1b26..2095ee253a8 100644 +index 31083792f8f..b490da9012f 100644 --- a/dlls/odbc32/proxyodbc.c +++ b/dlls/odbc32/proxyodbc.c @@ -4636,6 +4636,10 @@ static SQLRETURN col_attributes_unix_a( struct statement *stmt, SQLUSMALLINT col @@ -41,7 +41,7 @@ index db6ce0f1b26..2095ee253a8 100644 } /************************************************************************* -@@ -6295,8 +6305,28 @@ static SQLRETURN col_attribute_win32_w( struct statement *stmt, SQLUSMALLINT col +@@ -6295,8 +6305,34 @@ static SQLRETURN col_attribute_win32_w( struct statement *stmt, SQLUSMALLINT col if (stmt->hdr.win32_funcs->SQLColAttribute) { @@ -56,13 +56,19 @@ index db6ce0f1b26..2095ee253a8 100644 + + ret = stmt->hdr.win32_funcs->SQLColAttribute( stmt->hdr.win32_handle, col, field_id, strA, buflen, + retlen, num_attr ); -+ if (ret == SQL_SUCCESS && SQLColAttributes_KnownStringAttribute(field_id) && strA && retlen ) ++ if (ret == SQL_SUCCESS && SQLColAttributes_KnownStringAttribute(field_id)) + { -+ WCHAR *p = strnAtoW(strA, *retlen); -+ wcscpy(char_attr, p); -+ free(p); ++ if (strA) ++ { ++ WCHAR *p = strnAtoW(strA, -1); ++ wcscpy(char_attr, p); ++ free(p); + -+ *retlen = wcslen( char_attr ) * sizeof(WCHAR); ++ if (retlen) ++ *retlen = wcslen( char_attr ) * sizeof(WCHAR); ++ } ++ else if (retlen) ++ *retlen = *retlen * sizeof(WCHAR); + } + + if (strA != char_attr) diff --git a/patches/odbc32-fixes/0027-odbc32-SQLColAttributeW-Add-ascii-fallback.patch b/patches/odbc32-fixes/0027-odbc32-SQLColAttributeW-Add-ascii-fallback.patch new file mode 100644 index 00000000..dca5e23e --- /dev/null +++ b/patches/odbc32-fixes/0027-odbc32-SQLColAttributeW-Add-ascii-fallback.patch @@ -0,0 +1,70 @@ +From 9b10e9df425671cbf0811f436ccfd83e048b5cc9 Mon Sep 17 00:00:00 2001 +From: Alistair Leslie-Hughes +Date: Tue, 29 Apr 2025 13:08:38 +1000 +Subject: [PATCH] odbc32: SQLColAttributeW - Add ascii fallback + +--- + dlls/odbc32/proxyodbc.c | 39 +++++++++++++++++++++++++++++++++++++-- + 1 file changed, 37 insertions(+), 2 deletions(-) + +diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c +index b490da9012f..b17f8a46e0e 100644 +--- a/dlls/odbc32/proxyodbc.c ++++ b/dlls/odbc32/proxyodbc.c +@@ -6335,7 +6335,7 @@ static SQLRETURN col_attribute_win32_w( struct statement *stmt, SQLUSMALLINT col + return ret; + } + +- if (stmt->hdr.win32_funcs->SQLColAttributesW) ++ if (stmt->hdr.win32_funcs->SQLColAttributesW || stmt->hdr.win32_funcs->SQLColAttributes) + { + if (buflen < 0) return SQL_ERROR; + if (!col) +@@ -6383,8 +6383,43 @@ static SQLRETURN col_attribute_win32_w( struct statement *stmt, SQLUSMALLINT col + FIXME( "field id %u not handled\n", field_id ); + } + +- ret = stmt->hdr.win32_funcs->SQLColAttributesW( stmt->hdr.win32_handle, col, field_id, char_attr, buflen, ++ if (stmt->hdr.win32_funcs->SQLColAttributes) ++ { ++ SQLCHAR *strA = char_attr; ++ ++ if (char_attr && buflen && SQLColAttributes_KnownStringAttribute(field_id)) ++ { ++ strA = malloc( buflen ); ++ } ++ ++ ret = stmt->hdr.win32_funcs->SQLColAttributes( stmt->hdr.win32_handle, col, field_id, strA, buflen, ++ retlen, num_attr ); ++ ++ if (ret == SQL_SUCCESS && SQLColAttributes_KnownStringAttribute(field_id) && strA && retlen ) ++ { ++ if (strA) ++ { ++ WCHAR *p = strnAtoW(strA, -1); ++ wcscpy(char_attr, p); ++ free(p); ++ ++ if (retlen) ++ *retlen = wcslen( char_attr ) * sizeof(WCHAR); ++ } ++ else if (retlen) ++ *retlen = *retlen * sizeof(WCHAR); ++ } ++ ++ if (strA != char_attr) ++ free(strA); ++ ++ } ++ else ++ { ++ ret = stmt->hdr.win32_funcs->SQLColAttributesW( stmt->hdr.win32_handle, col, field_id, char_attr, buflen, + retlen, num_attr ); ++ } ++ + /* Convert back for ODBC2 drivers */ + env = (struct environment *)find_object_type(SQL_HANDLE_ENV, stmt->hdr.parent); + if (SQL_SUCCEEDED(ret) && num_attr && field_id == SQL_COLUMN_TYPE && +-- +2.47.2 +