Updated odbc32-fixes patchset

This commit is contained in:
Alistair Leslie-Hughes
2025-04-30 14:00:32 +10:00
parent 9f89b77e8f
commit eff3de6ad2
4 changed files with 144 additions and 46 deletions

View File

@@ -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 <leslie_alistair@hotmail.com>
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, &params );
}
@@ -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;

View File

@@ -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)

View File

@@ -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 <leslie_alistair@hotmail.com>
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)

View File

@@ -0,0 +1,70 @@
From 9b10e9df425671cbf0811f436ccfd83e048b5cc9 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
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