Rebase against 6e15604c48acd63dd8095a4ce2fd011cb3be96db.

This commit is contained in:
Alistair Leslie-Hughes
2024-08-21 07:52:15 +10:00
parent 41367bc540
commit b9a08f8300
8 changed files with 25 additions and 492 deletions

View File

@@ -1,55 +0,0 @@
From 8002ebd60de0c6d9eb718eb58599a41823b3d930 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Fri, 12 Jul 2024 14:19:22 +1000
Subject: [PATCH] odbc32: SQLColAttributeW support fallback function
---
dlls/odbc32/proxyodbc.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
index 4f23c761f5a..5ead68700df 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -5893,6 +5893,21 @@ static SQLRETURN col_attribute_unix_w( struct statement *stmt, SQLUSMALLINT col,
return ret;
}
+static SQLINTEGER map_odbc3_to_2(SQLINTEGER fieldid)
+{
+ switch( fieldid )
+ {
+ case SQL_DESC_COUNT:
+ return SQL_COLUMN_COUNT;
+ case SQL_DESC_NULLABLE:
+ return SQL_COLUMN_NULLABLE;
+ case SQL_DESC_NAME:
+ return SQL_COLUMN_NAME;
+ default:
+ return fieldid;
+ }
+}
+
static SQLRETURN col_attribute_win32_w( struct statement *stmt, SQLUSMALLINT col, SQLUSMALLINT field_id,
SQLPOINTER char_attr, SQLSMALLINT buflen, SQLSMALLINT *retlen,
SQLLEN *num_attr )
@@ -5900,7 +5915,16 @@ static SQLRETURN col_attribute_win32_w( struct statement *stmt, SQLUSMALLINT col
if (stmt->hdr.win32_funcs->SQLColAttributeW)
return stmt->hdr.win32_funcs->SQLColAttributeW( stmt->hdr.win32_handle, col, field_id, char_attr, buflen,
retlen, num_attr );
+ else if(stmt->hdr.win32_funcs->SQLColAttributesW)
+ {
+ /* ODBC v2 */
+ field_id = map_odbc3_to_2(field_id);
+ return stmt->hdr.win32_funcs->SQLColAttributesW( stmt->hdr.win32_handle, col, field_id,
+ char_attr, buflen, retlen,
+ num_attr );
+ }
if (stmt->hdr.win32_funcs->SQLColAttribute) FIXME( "Unicode to ANSI conversion not handled\n" );
+
return SQL_ERROR;
}
--
2.43.0

View File

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

View File

@@ -1,30 +1,32 @@
From 7fd12044418fbd610b920961db964ff0acd098f4 Mon Sep 17 00:00:00 2001
From 6b7448e5ebdc0b16f3af606a62e2ca465f3ae026 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Wed, 17 Jul 2024 22:03:03 +1000
Subject: [PATCH] odbc32: SQLColAttributesW support ODBC v2.0
---
dlls/odbc32/proxyodbc.c | 22 +++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
dlls/odbc32/proxyodbc.c | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
index b2bf2a7d58c..f7a6535db37 100644
index 71c853013fd..b5c0edb119e 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -5973,11 +5973,27 @@ static SQLRETURN col_attribute_win32_w( struct statement *stmt, SQLUSMALLINT col
@@ -6195,6 +6195,8 @@ static SQLRETURN col_attribute_win32_w( struct statement *stmt, SQLUSMALLINT col
SQLPOINTER char_attr, SQLSMALLINT buflen, SQLSMALLINT *retlen,
SQLLEN *num_attr )
{
+ SQLRETURN ret = SQL_ERROR;
+
if (stmt->hdr.win32_funcs->SQLColAttributeW)
return stmt->hdr.win32_funcs->SQLColAttributeW( stmt->hdr.win32_handle, col, field_id, char_attr, buflen,
retlen, num_attr );
else if(stmt->hdr.win32_funcs->SQLColAttributesW)
{
+ SQLRETURN ret;
+
/* ODBC v2 */
field_id = map_odbc3_to_2(field_id);
- return stmt->hdr.win32_funcs->SQLColAttributesW( stmt->hdr.win32_handle, col, field_id,
- char_attr, buflen, retlen,
- num_attr );
+ ret = stmt->hdr.win32_funcs->SQLColAttributesW( stmt->hdr.win32_handle, col, field_id,
+ char_attr, buflen, retlen, num_attr );
+
@@ -6237,11 +6239,23 @@ static SQLRETURN col_attribute_win32_w( struct statement *stmt, SQLUSMALLINT col
return SQL_ERROR;
}
- return stmt->hdr.win32_funcs->SQLColAttributesW( stmt->hdr.win32_handle, col, field_id, char_attr, buflen,
+ ret = stmt->hdr.win32_funcs->SQLColAttributesW( stmt->hdr.win32_handle, col, field_id, char_attr, buflen,
retlen, num_attr );
+ /* Convert back for ODBC3 drivers */
+ if (num_attr && field_id == SQL_COLUMN_TYPE &&
+ ((struct environment*)(stmt->hdr.parent))->attr_version == SQL_OV_ODBC2 &&
@@ -37,11 +39,13 @@ index b2bf2a7d58c..f7a6535db37 100644
+ else if (*num_attr == SQL_TIMESTAMP)
+ *num_attr = SQL_TYPE_TIMESTAMP;
+ }
+
+ return ret;
}
if (stmt->hdr.win32_funcs->SQLColAttribute) FIXME( "Unicode to ANSI conversion not handled\n" );
- return SQL_ERROR;
+ return ret;
}
/*************************************************************************
--
2.43.0