Updated odbc32-fixes patchset

More support for the PostgreSQL ODBC ascii driver.
This commit is contained in:
Alistair Leslie-Hughes
2025-05-01 06:50:48 +10:00
parent c89fe8069e
commit 42a307df67
4 changed files with 145 additions and 1 deletions

View File

@@ -37,7 +37,7 @@ index b490da9012f..b17f8a46e0e 100644
+ 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 (ret == SQL_SUCCESS && SQLColAttributes_KnownStringAttribute(field_id) )
+ {
+ if (strA)
+ {

View File

@@ -0,0 +1,56 @@
From 2b03235b360575563a2ffee961c9447699edce0d Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Thu, 1 May 2025 07:32:58 +1000
Subject: [PATCH] SQLGetDiagRecW: Add ascii fallback
---
dlls/odbc32/proxyodbc.c | 25 +++++++++++++++++++++++--
1 file changed, 23 insertions(+), 2 deletions(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
index b607c361416..377124653c1 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -6716,8 +6716,9 @@ static SQLRETURN get_diag_rec_win32_w( SQLSMALLINT type, struct object *obj, SQL
return SQL_ERROR;
}
- if (obj->win32_funcs->SQLErrorW)
+ if (obj->win32_funcs->SQLErrorW || obj->win32_funcs->SQLError)
{
+ SQLRETURN ret = SQL_ERROR;
SQLHENV env = NULL;
SQLHDBC con = NULL;
SQLHSTMT stmt = NULL;
@@ -6742,7 +6743,27 @@ static SQLRETURN get_diag_rec_win32_w( SQLSMALLINT type, struct object *obj, SQL
return SQL_ERROR;
}
- return obj->win32_funcs->SQLErrorW( env, con, stmt, state, native_err, msg, buflen, retlen );
+ if (obj->win32_funcs->SQLErrorW)
+ ret = obj->win32_funcs->SQLErrorW( env, con, stmt, state, native_err, msg, buflen, retlen );
+ else if (obj->win32_funcs->SQLError)
+ {
+ SQLCHAR stateA[6], *msgA = NULL;
+ SQLSMALLINT lenA;
+
+ if (!(msgA = malloc( buflen ))) return SQL_ERROR;
+ ret = obj->win32_funcs->SQLError( env, con, stmt, stateA, native_err, msgA, buflen, &lenA );
+ if (SUCCESS( ret ))
+ {
+ WCHAR *p = strnAtoW(msgA, lenA);
+ wcscpy(msg, p);
+ free(p);
+
+ MultiByteToWideChar( CP_ACP, 0, (const char *)stateA, 6, state, 12 );
+ }
+ free( msgA );
+
+ }
+ return ret;
}
return SQL_ERROR;
--
2.47.2

View File

@@ -0,0 +1,52 @@
From 7f895746aa93f74933dab0f2e115c4feb2d57556 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Thu, 1 May 2025 08:05:31 +1000
Subject: [PATCH] odbc32: SQLNativeSqlW add ascii fallback
---
dlls/odbc32/proxyodbc.c | 26 ++++++++++++++++++++++++--
1 file changed, 24 insertions(+), 2 deletions(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
index ca2f94cb250..799ea5accf2 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -7819,11 +7819,33 @@ static SQLRETURN native_sql_unix_w( struct connection *con, SQLWCHAR *in_stateme
static SQLRETURN native_sql_win32_w( struct connection *con, SQLWCHAR *in_statement, SQLINTEGER len,
SQLWCHAR *out_statement, SQLINTEGER buflen, SQLINTEGER *retlen )
{
+ SQLRETURN ret = SQL_ERROR;
+
if (con->hdr.win32_funcs->SQLNativeSqlW)
return con->hdr.win32_funcs->SQLNativeSqlW( con->hdr.win32_handle, in_statement, len, out_statement, buflen,
retlen );
- if (con->hdr.win32_funcs->SQLNativeSql) FIXME( "Unicode to ANSI conversion not handled\n" );
- return SQL_ERROR;
+ if (con->hdr.win32_funcs->SQLNativeSql)
+ {
+ SQLCHAR *statement = (SQLCHAR*)strdupWtoA( (WCHAR*)in_statement );
+ SQLCHAR *out = NULL;
+ if (buflen)
+ out = malloc( buflen );
+
+ ret = con->hdr.win32_funcs->SQLNativeSql( con->hdr.win32_handle, statement, len, out, buflen, retlen );
+ if(ret == SQL_SUCCESS)
+ {
+ if (out_statement)
+ {
+ MultiByteToWideChar( CP_ACP, 0, (const char *)out, len, out_statement, buflen );
+ out_statement[buflen] = 0;
+ }
+ }
+ if (retlen) *retlen *= sizeof(WCHAR);
+
+ free( statement );
+ free( out );
+ }
+ return ret;
}
/*************************************************************************
--
2.47.2

View File

@@ -0,0 +1,36 @@
From fbc17da7bbb48155d2fe1225f159a2b50b7aaf65 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Thu, 1 May 2025 08:10:04 +1000
Subject: [PATCH] odbc32: SQLPrepareW add ascii fallback
---
dlls/odbc32/proxyodbc.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
index 799ea5accf2..0fed17640c1 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -6199,10 +6199,17 @@ static SQLRETURN prepare_unix_w( struct statement *stmt, SQLWCHAR *statement, SQ
static SQLRETURN prepare_win32_w( struct statement *stmt, SQLWCHAR *statement, SQLINTEGER len )
{
+ SQLRETURN ret = SQL_ERROR;
+
if (stmt->hdr.win32_funcs->SQLPrepareW)
return stmt->hdr.win32_funcs->SQLPrepareW( stmt->hdr.win32_handle, statement, len );
- if (stmt->hdr.win32_funcs->SQLPrepare) FIXME( "Unicode to ANSI conversion not handled\n" );
- return SQL_ERROR;
+ if (stmt->hdr.win32_funcs->SQLPrepare)
+ {
+ SQLCHAR *statementA = (SQLCHAR*)strdupWtoA( statement );
+ ret = stmt->hdr.win32_funcs->SQLPrepare( stmt->hdr.win32_handle, statementA, len );
+ free(statementA);
+ }
+ return ret;
}
/*************************************************************************
--
2.47.2