2024-08-12 18:20:56 -07:00
|
|
|
From 397d95d8e50299f949ac73b0cc245f5fe66cacae Mon Sep 17 00:00:00 2001
|
2024-07-14 14:20:30 -07:00
|
|
|
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
|
|
|
Date: Fri, 12 Jul 2024 14:29:17 +1000
|
2024-08-12 18:20:56 -07:00
|
|
|
Subject: [PATCH] odbc32: SQLGetDiagRec/W handle fallback function
|
2024-07-14 14:20:30 -07:00
|
|
|
|
|
|
|
---
|
2024-08-12 18:20:56 -07:00
|
|
|
dlls/odbc32/proxyodbc.c | 34 +++++++++++++++++++++++++++++++---
|
|
|
|
1 file changed, 31 insertions(+), 3 deletions(-)
|
2024-07-14 14:20:30 -07:00
|
|
|
|
|
|
|
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
|
2024-08-12 18:20:56 -07:00
|
|
|
index 5ead68700df..97c4cac8e31 100644
|
2024-07-14 14:20:30 -07:00
|
|
|
--- a/dlls/odbc32/proxyodbc.c
|
|
|
|
+++ b/dlls/odbc32/proxyodbc.c
|
2024-08-12 18:20:56 -07:00
|
|
|
@@ -2672,7 +2672,21 @@ SQLRETURN WINAPI SQLGetDiagRec(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMAL
|
2024-07-14 14:20:30 -07:00
|
|
|
}
|
2024-08-12 18:20:56 -07:00
|
|
|
else if (obj->win32_handle)
|
2024-07-14 14:20:30 -07:00
|
|
|
{
|
2024-08-12 18:20:56 -07:00
|
|
|
- ret = get_diag_rec_win32_a( HandleType, obj, RecNumber, SqlState, NativeError, MessageText, BufferLength,
|
2024-07-15 16:23:21 -07:00
|
|
|
+ /* ODBC v2.0 */
|
2024-08-12 18:20:56 -07:00
|
|
|
+ if (obj->win32_funcs->SQLError)
|
2024-07-14 14:20:30 -07:00
|
|
|
+ {
|
|
|
|
+ if (HandleType == SQL_HANDLE_ENV)
|
2024-08-12 18:20:56 -07:00
|
|
|
+ ret = obj->win32_funcs->SQLError(obj->win32_handle, SQL_NULL_HDBC, SQL_NULL_HSTMT,
|
2024-07-14 14:20:30 -07:00
|
|
|
+ SqlState, NativeError, MessageText, BufferLength, TextLength);
|
|
|
|
+ else if (HandleType == SQL_HANDLE_DBC)
|
2024-08-12 18:20:56 -07:00
|
|
|
+ ret = obj->win32_funcs->SQLError(SQL_NULL_HENV, obj->win32_handle, SQL_NULL_HSTMT,
|
2024-07-14 14:20:30 -07:00
|
|
|
+ SqlState, NativeError, MessageText, BufferLength, TextLength);
|
|
|
|
+ else if (HandleType == SQL_HANDLE_STMT)
|
2024-08-12 18:20:56 -07:00
|
|
|
+ ret = obj->win32_funcs->SQLError(SQL_NULL_HENV, SQL_NULL_HDBC, obj->win32_handle,
|
2024-07-14 14:20:30 -07:00
|
|
|
+ SqlState, NativeError, MessageText, BufferLength, TextLength);
|
|
|
|
+ }
|
2024-07-15 16:23:21 -07:00
|
|
|
+ else
|
2024-08-12 18:20:56 -07:00
|
|
|
+ ret = get_diag_rec_win32_a( HandleType, obj, RecNumber, SqlState, NativeError, MessageText, BufferLength,
|
2024-07-15 16:23:21 -07:00
|
|
|
TextLength );
|
2024-07-14 14:20:30 -07:00
|
|
|
}
|
|
|
|
|
2024-08-12 18:20:56 -07:00
|
|
|
@@ -6187,9 +6201,23 @@ static SQLRETURN get_diag_rec_win32_w( SQLSMALLINT type, struct object *obj, SQL
|
|
|
|
SQLSMALLINT *retlen )
|
|
|
|
{
|
|
|
|
if (obj->win32_funcs->SQLGetDiagRecW)
|
|
|
|
- return obj->win32_funcs->SQLGetDiagRecW( type, obj->win32_handle, rec_num, state, native_err, msg, buflen,
|
|
|
|
- retlen );
|
|
|
|
+ return obj->win32_funcs->SQLGetDiagRecW( type, obj->win32_handle, rec_num, state, native_err,
|
|
|
|
+ msg, buflen, retlen );
|
|
|
|
+ else if (obj->win32_funcs->SQLErrorW)
|
2024-07-15 16:23:21 -07:00
|
|
|
+ {
|
|
|
|
+ /* ODBC v2 */
|
2024-08-12 18:20:56 -07:00
|
|
|
+ if (type == SQL_HANDLE_ENV)
|
|
|
|
+ return obj->win32_funcs->SQLErrorW(obj->win32_handle, SQL_NULL_HDBC, SQL_NULL_HSTMT,
|
2024-07-15 16:23:21 -07:00
|
|
|
+ state, native_err, msg, buflen, retlen);
|
2024-08-12 18:20:56 -07:00
|
|
|
+ else if (type == SQL_HANDLE_DBC)
|
|
|
|
+ return obj->win32_funcs->SQLErrorW(SQL_NULL_HENV, obj->win32_handle, SQL_NULL_HSTMT,
|
2024-07-15 16:23:21 -07:00
|
|
|
+ state, native_err, msg, buflen, retlen);
|
2024-08-12 18:20:56 -07:00
|
|
|
+ else if (type == SQL_HANDLE_STMT)
|
|
|
|
+ return obj->win32_funcs->SQLErrorW(SQL_NULL_HENV, SQL_NULL_HDBC, obj->win32_handle,
|
2024-07-15 16:23:21 -07:00
|
|
|
+ state, native_err, msg, buflen, retlen);
|
|
|
|
+ }
|
2024-08-12 18:20:56 -07:00
|
|
|
if (obj->win32_funcs->SQLGetDiagRec) FIXME( "Unicode to ANSI conversion not handled\n" );
|
|
|
|
+
|
2024-07-15 16:23:21 -07:00
|
|
|
return SQL_ERROR;
|
|
|
|
}
|
2024-08-12 18:20:56 -07:00
|
|
|
|
2024-07-14 14:20:30 -07:00
|
|
|
--
|
|
|
|
2.43.0
|
|
|
|
|