From 21a71e43b28c93af8db4122b914b5ccf88086390 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Sat, 31 Aug 2024 13:44:40 +1000 Subject: [PATCH] Updated odbc32-fixes patchset Correct finding Environment Handle. Check for error before converting type. --- ...-odbc32-SQLGetData-support-ODBC-v2.0.patch | 29 ++++++++++++++----- ...-SQLColAttributesW-support-ODBC-v2.0.patch | 4 +-- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/patches/odbc32-fixes/0013-odbc32-SQLGetData-support-ODBC-v2.0.patch b/patches/odbc32-fixes/0013-odbc32-SQLGetData-support-ODBC-v2.0.patch index aefe28f8..bf5d3382 100644 --- a/patches/odbc32-fixes/0013-odbc32-SQLGetData-support-ODBC-v2.0.patch +++ b/patches/odbc32-fixes/0013-odbc32-SQLGetData-support-ODBC-v2.0.patch @@ -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 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 diff --git a/patches/odbc32-fixes/0014-odbc32-SQLColAttributesW-support-ODBC-v2.0.patch b/patches/odbc32-fixes/0014-odbc32-SQLColAttributesW-support-ODBC-v2.0.patch index e227da7a..4d9b6333 100644 --- a/patches/odbc32-fixes/0014-odbc32-SQLColAttributesW-support-ODBC-v2.0.patch +++ b/patches/odbc32-fixes/0014-odbc32-SQLColAttributesW-support-ODBC-v2.0.patch @@ -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) + {