You've already forked wine-staging
mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2025-09-12 18:50:20 -07:00
71 lines
2.6 KiB
Diff
71 lines
2.6 KiB
Diff
From 6906a9555d2410c326e3c1273052ee25a1156e1c 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 ANSI 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 11a9633af82..d6946e1c66d 100644
|
|
--- a/dlls/odbc32/proxyodbc.c
|
|
+++ b/dlls/odbc32/proxyodbc.c
|
|
@@ -6410,7 +6410,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)
|
|
@@ -6459,8 +6459,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) )
|
|
+ {
|
|
+ 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.50.1
|
|
|