Updated odbc32-fixes patchset

Correct finding Environment Handle.
Check for error before converting type.
This commit is contained in:
Alistair Leslie-Hughes 2024-08-31 13:44:40 +10:00
parent fdd5079133
commit 21a71e43b2
2 changed files with 24 additions and 9 deletions

View File

@ -1,22 +1,37 @@
From ad0e5c8a6edd8f483ad3b2cd389b6ec5519b3891 Mon Sep 17 00:00:00 2001
From 2d897946980e67f742b9f39f5f548cf0e2340510 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Wed, 17 Jul 2024 21:55:20 +1000
Subject: [PATCH] odbc32: SQLGetData support ODBC v2.0
---
dlls/odbc32/proxyodbc.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
dlls/odbc32/proxyodbc.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
index 1977e766950..b2bf2a7d58c 100644
index 3b3b198eaa8..c2748cd33d7 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -2368,7 +2368,20 @@ static SQLRETURN get_data_win32( struct statement *stmt, SQLUSMALLINT column, SQ
@@ -2450,11 +2450,35 @@ static SQLRETURN get_data_unix( struct statement *stmt, SQLUSMALLINT column, SQL
return ret;
}
+static struct object *find_object_type(SQLSMALLINT type, struct object *object)
+{
+ while (object && object->type != type)
+ {
+ object = object->parent;
+ }
+
+ return object;
+}
+
static SQLRETURN get_data_win32( struct statement *stmt, SQLUSMALLINT column, SQLSMALLINT type, SQLPOINTER value,
SQLLEN buflen, SQLLEN *retlen )
{
if (stmt->hdr.win32_funcs->SQLGetData)
+ {
+ if ( ((struct environment*)(stmt->hdr.parent))->attr_version == SQL_OV_ODBC2)
+ struct environment *env = (struct environment *)find_object_type(SQL_HANDLE_ENV, stmt->hdr.parent);
+ if (env && env->attr_version == SQL_OV_ODBC2)
+ {
+ if (type == SQL_C_TYPE_TIME)
+ type = SQL_C_TIME;
@ -33,5 +48,5 @@ index 1977e766950..b2bf2a7d58c 100644
}
--
2.43.0
2.45.2

View File

@ -27,8 +27,8 @@ index 71c853013fd..b5c0edb119e 100644
- 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 &&
+ /* Convert back for ODBC2 drivers */
+ if (SQL_SUCCEEDED(ret) && num_attr && field_id == SQL_COLUMN_TYPE &&
+ ((struct environment*)(stmt->hdr.parent))->attr_version == SQL_OV_ODBC2 &&
+ ((struct environment*)(stmt->hdr.parent))->driver_ver == SQL_OV_ODBC2)
+ {