Updated odbc32-fixes patchset

Completed patchset to get PostgreSQL ASCII driver working.
This commit is contained in:
Alistair Leslie-Hughes
2025-04-28 11:04:44 +10:00
parent 353a868136
commit f01e66252c
3 changed files with 107 additions and 22 deletions

View File

@@ -1,25 +1,27 @@
From b69941179da4ae6c1d5db0b6b883fe8442e511c3 Mon Sep 17 00:00:00 2001
From cbf28db0610f67e37193b8c7d773614a3f0674db Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Sat, 26 Apr 2025 17:51:54 +1000
Subject: [PATCH] odbc32: SQLSetStmtAttrW add ascii fallback
---
dlls/odbc32/proxyodbc.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
dlls/odbc32/proxyodbc.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
index 1036e6cfa96..cc638b63ddd 100644
index e8ce1fa944c..d72c6ff4b01 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -8031,7 +8031,11 @@ static SQLRETURN set_stmt_attr_win32_w( struct statement *stmt, SQLINTEGER attr,
@@ -8032,7 +8032,13 @@ 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" );
+ if (stmt->hdr.win32_funcs->SQLSetStmtAttr)
+ {
+ FIXME( "Unicode to ANSI conversion not handled\n" );
+ return stmt->hdr.win32_funcs->SQLSetStmtAttr( stmt->hdr.win32_handle, attr, value, len );
+ SQLRETURN ret = stmt->hdr.win32_funcs->SQLSetStmtAttr( stmt->hdr.win32_handle, attr, value, len );
+ if (ret == SQL_ERROR)
+ FIXME( "Unicode to ANSI conversion not handled (%d)\n", attr );
+ return ret;
+ }
else if (stmt->hdr.win32_funcs->SQLSetStmtOption)
{

View File

@@ -1,31 +1,33 @@
From 7020fa486aeaffb34399dd882cb817feb6a15adc Mon Sep 17 00:00:00 2001
From 74f21e527480e68e05913e5fa09fb5fa9d042e04 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Sat, 26 Apr 2025 19:18:17 +1000
Subject: [PATCH] odbc32: Various ascii fallback
Needs spliting.
---
dlls/odbc32/proxyodbc.c | 34 +++++++++++++++++++++++++++++-----
1 file changed, 29 insertions(+), 5 deletions(-)
dlls/odbc32/proxyodbc.c | 40 +++++++++++++++++++++++++++++++++++-----
1 file changed, 35 insertions(+), 5 deletions(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
index 81f5cb9a799..8d8448657ee 100644
index 81f5cb9a799..e965a86bf15 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -6411,7 +6411,11 @@ static SQLRETURN get_connect_attr_win32_w( struct connection *con, SQLINTEGER at
@@ -6411,7 +6411,13 @@ static SQLRETURN get_connect_attr_win32_w( struct connection *con, SQLINTEGER at
{
if (con->hdr.win32_funcs->SQLGetConnectAttrW)
return con->hdr.win32_funcs->SQLGetConnectAttrW( con->hdr.win32_handle, attr, value, buflen, retlen );
- if (con->hdr.win32_funcs->SQLGetConnectAttr) FIXME( "Unicode to ANSI conversion not handled\n" );
+ if (con->hdr.win32_funcs->SQLGetConnectAttr)
+ {
+ FIXME( "Unicode to ANSI conversion not handled\n" );
+ return con->hdr.win32_funcs->SQLGetConnectAttr( con->hdr.win32_handle, attr, value, buflen, retlen );
+ SQLRETURN ret = con->hdr.win32_funcs->SQLGetConnectAttr( con->hdr.win32_handle, attr, value, buflen, retlen );
+ if (ret == SQL_ERROR)
+ FIXME( "Unicode to ANSI conversion not handled\n" );
+ return ret;
+ }
return SQL_ERROR;
}
@@ -6577,7 +6581,12 @@ static SQLRETURN get_diag_field_win32_w( SQLSMALLINT type, struct object *obj, S
@@ -6577,7 +6583,12 @@ static SQLRETURN get_diag_field_win32_w( SQLSMALLINT type, struct object *obj, S
if (obj->win32_funcs->SQLGetDiagFieldW)
return obj->win32_funcs->SQLGetDiagFieldW( type, obj->win32_handle, rec_num, diag_id, diag_info, buflen,
retlen );
@@ -39,20 +41,22 @@ index 81f5cb9a799..8d8448657ee 100644
return SQL_ERROR;
}
@@ -6780,7 +6789,11 @@ static SQLRETURN set_connect_attr_win32_w( struct connection *con, SQLINTEGER at
@@ -6780,7 +6791,13 @@ 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" );
+ if (con->hdr.win32_funcs->SQLSetConnectAttr)
+ {
+ FIXME( "Unicode to ANSI conversion not handled\n" );
+ return con->hdr.win32_funcs->SQLSetConnectAttr( con->hdr.win32_handle, attr, value, len );
+ SQLRETURN ret = con->hdr.win32_funcs->SQLSetConnectAttr( con->hdr.win32_handle, attr, value, len );
+ if (ret == SQL_ERROR)
+ FIXME( "Unicode to ANSI conversion not handled\n" );
+ return ret;
+ }
else if(con->hdr.win32_funcs->SQLSetConnectOptionW)
{
/* ODBC v2 */
@@ -7066,10 +7079,17 @@ static BOOL typeinfo_is_string( SQLSMALLINT type )
@@ -7066,10 +7083,17 @@ static BOOL typeinfo_is_string( SQLSMALLINT type )
{
case SQL_DRIVER_ODBC_VER:
case SQL_DRIVER_NAME:
@@ -71,15 +75,17 @@ index 81f5cb9a799..8d8448657ee 100644
return FALSE;
}
}
@@ -7978,7 +7998,11 @@ static SQLRETURN set_desc_field_win32_w( struct descriptor *desc, SQLSMALLINT re
@@ -7978,7 +8002,13 @@ static SQLRETURN set_desc_field_win32_w( struct descriptor *desc, SQLSMALLINT re
{
if (desc->hdr.win32_funcs->SQLSetDescFieldW)
return desc->hdr.win32_funcs->SQLSetDescFieldW( desc->hdr.win32_handle, record, id, value, len );
- if (desc->hdr.win32_funcs->SQLSetDescField) FIXME( "Unicode to ANSI conversion not handled\n" );
+ if (desc->hdr.win32_funcs->SQLSetDescField)
+ {
+ FIXME( "Unicode to ANSI conversion not handled\n" );
+ return desc->hdr.win32_funcs->SQLSetDescField( desc->hdr.win32_handle, record, id, value, len );
+ SQLRETURN ret = desc->hdr.win32_funcs->SQLSetDescField( desc->hdr.win32_handle, record, id, value, len );
+ if (ret == SQL_ERROR)
+ FIXME( "Unicode to ANSI conversion not handled (%d)\n", id );
+ return ret;
+ }
return SQL_ERROR;
}

View File

@@ -0,0 +1,77 @@
From 0fd8102e0967e53191b27a00bb9a1f3d8cfe9f7c 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(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
index db6ce0f1b26..2095ee253a8 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
return ret;
}
+static SQLRETURN col_attribute_win32_w( struct statement *stmt, SQLUSMALLINT col, SQLUSMALLINT field_id,
+ SQLPOINTER char_attr, SQLSMALLINT buflen, SQLSMALLINT *retlen,
+ SQLLEN *num_attr );
+
static SQLRETURN col_attributes_win32_a( struct statement *stmt, SQLUSMALLINT col, SQLUSMALLINT field_id,
SQLPOINTER char_attrs, SQLSMALLINT buflen, SQLSMALLINT *retlen,
SQLLEN *num_attrs )
@@ -5839,11 +5843,17 @@ static SQLRETURN col_attributes_win32_w( struct statement *stmt, SQLUSMALLINT co
SQLPOINTER char_attrs, SQLSMALLINT buflen, SQLSMALLINT *retlen,
SQLLEN *num_attrs )
{
+ SQLRETURN ret = SQL_ERROR;
+
if (stmt->hdr.win32_funcs->SQLColAttributesW)
return stmt->hdr.win32_funcs->SQLColAttributesW( stmt->hdr.win32_handle, col, field_id, char_attrs, buflen,
retlen, num_attrs );
if (stmt->hdr.win32_funcs->SQLColAttributes) FIXME( "Unicode to ANSI conversion not handled\n" );
- return SQL_ERROR;
+ else
+ {
+ ret = col_attribute_win32_w( stmt, col, field_id, char_attrs, buflen, retlen, num_attrs );
+ }
+ return ret;
}
/*************************************************************************
@@ -6295,8 +6305,28 @@ static SQLRETURN col_attribute_win32_w( struct statement *stmt, SQLUSMALLINT col
if (stmt->hdr.win32_funcs->SQLColAttribute)
{
- FIXME( "Unicode to ANSI conversion not handled\n" );
- return SQL_ERROR;
+ SQLCHAR *strA = char_attr;
+
+ if (char_attr && buflen && SQLColAttributes_KnownStringAttribute(field_id))
+ {
+ strA = malloc( buflen );
+ }
+
+ 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 )
+ {
+ WCHAR *p = strnAtoW(strA, *retlen);
+ wcscpy(char_attr, p);
+ free(p);
+
+ *retlen = wcslen( char_attr ) * sizeof(WCHAR);
+ }
+
+ if (strA != char_attr)
+ free(strA);
+
+ return ret;
}
if (stmt->hdr.win32_funcs->SQLColAttributesW)
--
2.47.2