Rebase against c1bafaa02329442df1aba576e2884c0ab699f76e.

This commit is contained in:
Alistair Leslie-Hughes
2025-10-09 09:42:39 +11:00
parent 672a2bae70
commit 6f356eb1f5
6 changed files with 49 additions and 107 deletions

View File

@@ -1,23 +1,24 @@
From 7f4fd1e72d8639c2fa0ee309ed6ffa9acb13eccf Mon Sep 17 00:00:00 2001
From d48d22a1961995d2bcee9bcdd05ed1f7381d5ebe Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Fri, 12 Jul 2024 14:40:32 +1000
Subject: [PATCH] odbc32: SQLBindParameter handle fallback function
---
dlls/odbc32/proxyodbc.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
dlls/odbc32/proxyodbc.c | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
index 1add621ca31..7723b9516ac 100644
index 7cc31f7a854..335f9ab1a49 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -5580,9 +5580,37 @@ static SQLRETURN bind_parameter_win32( struct statement *stmt, SQLUSMALLINT para
@@ -5721,9 +5721,38 @@ static SQLRETURN bind_parameter_win32( struct statement *stmt, SQLUSMALLINT para
SQLSMALLINT value_type, SQLSMALLINT param_type, SQLULEN size,
SQLSMALLINT digits, SQLPOINTER value, SQLLEN buflen, SQLLEN *len )
{
+ struct environment *env = (struct environment *)find_object_type(SQL_HANDLE_ENV, stmt->hdr.parent);
+ struct connection *conn = (struct connection *)find_object_type(SQL_HANDLE_DBC, stmt->hdr.parent);
+
+ if (env && env->attr_version == SQL_OV_ODBC3 && env->driver_ver == SQL_OV_ODBC2)
+ if (env && env->attr_version == SQL_OV_ODBC3 && conn && conn->driver_odbc_ver < 0x300)
+ {
+ /* ODBC v2 */
+ /* TODO: Make function */
@@ -50,5 +51,5 @@ index 1add621ca31..7723b9516ac 100644
}
--
2.50.1
2.51.0

View File

@@ -1,78 +0,0 @@
From 058007da8ce50113b1bc46352d98f20850dda064 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Thu, 18 Jul 2024 07:13:48 +1000
Subject: [PATCH] odbc32: Record loaded driver SQL_ATTR_ODBC_VERSION
---
dlls/odbc32/proxyodbc.c | 28 ++++++++++++++++++++++++++++
dlls/odbc32/unixlib.h | 1 +
2 files changed, 29 insertions(+)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
index c2e21f16e3a..3d4c58badfe 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -325,6 +325,19 @@ static CRITICAL_SECTION_DEBUG loader_cs_debug =
};
static CRITICAL_SECTION loader_cs = { &loader_cs_debug, -1, 0, 0, 0, 0 };
+static SQLRETURN get_info_win32_w( struct connection *con, SQLUSMALLINT type, SQLPOINTER value, SQLSMALLINT buflen,
+ SQLSMALLINT *retlen );
+
+static struct object *find_object_type(SQLSMALLINT type, struct object *object)
+{
+ while (object && object->type != type)
+ {
+ object = object->parent;
+ }
+
+ return object;
+}
+
static struct
{
UINT32 count;
@@ -464,6 +477,7 @@ static struct environment *create_environment( void )
if (!(ret = calloc( 1, sizeof(*ret) ))) return NULL;
init_object( &ret->hdr, SQL_HANDLE_ENV, NULL );
ret->attr_version = SQL_OV_ODBC2;
+ ret->driver_ver = SQL_OV_ODBC2;
return ret;
}
@@ -1344,6 +1358,20 @@ static void prepare_con( struct connection *con )
WARN( "failed to set connection timeout\n" );
if (set_con_attr( con, SQL_ATTR_LOGIN_TIMEOUT, INT_PTR(con->attr_login_timeout), 0 ))
WARN( "failed to set login timeout\n" );
+
+ if (con->hdr.win32_handle)
+ {
+ WCHAR ver[16];
+ SQLRETURN ret = SQL_ERROR;
+
+ ret = get_info_win32_w( con, SQL_DRIVER_ODBC_VER, &ver, sizeof(ver), NULL);
+ if (SUCCESS( ret ))
+ {
+ struct environment *env = (struct environment *)find_object_type(SQL_HANDLE_ENV, con->hdr.parent);
+ long nMajor = _wtol( ver );
+ env->driver_ver = nMajor == 2 ? SQL_OV_ODBC2 : SQL_OV_ODBC3;
+ }
+ }
}
static SQLRETURN create_con( struct connection *con )
diff --git a/dlls/odbc32/unixlib.h b/dlls/odbc32/unixlib.h
index c865a83711d..4ff13a68add 100644
--- a/dlls/odbc32/unixlib.h
+++ b/dlls/odbc32/unixlib.h
@@ -205,6 +205,7 @@ struct environment
UINT32 sources_idx;
void *sources_key;
BOOL sources_system;
+ UINT32 driver_ver;
};
struct connection
--
2.50.1

View File

@@ -1,24 +1,41 @@
From 9996d4b09e7ffbce58f34424475c6fcf257e6476 Mon Sep 17 00:00:00 2001
From 382186c3e3c55cd9ab0ada21456e09f25bf740ab 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 | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
dlls/odbc32/proxyodbc.c | 25 ++++++++++++++++++++++++-
1 file changed, 24 insertions(+), 1 deletion(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
index 46e7ffc1d95..c95603b7030 100644
index b61d7ab4fa6..1fb4c651e4c 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -2576,8 +2576,21 @@ static SQLRETURN get_data_win32( struct statement *stmt, SQLUSMALLINT column, SQ
@@ -327,6 +327,16 @@ static CRITICAL_SECTION_DEBUG loader_cs_debug =
};
static CRITICAL_SECTION loader_cs = { &loader_cs_debug, -1, 0, 0, 0, 0 };
+static struct object *find_object_type(SQLSMALLINT type, struct object *object)
+{
+ while (object && object->type != type)
+ {
+ object = object->parent;
+ }
+
+ return object;
+}
+
static struct
{
UINT32 count;
@@ -2632,8 +2642,21 @@ static SQLRETURN get_data_win32( struct statement *stmt, SQLUSMALLINT column, SQ
free( data );
return ret;
}
+ else
+ {
+ struct environment *env = (struct environment *)find_object_type(SQL_HANDLE_ENV, stmt->hdr.parent);
+ if (env && env->driver_ver == SQL_OV_ODBC2)
+ struct connection *conn = (struct connection *)find_object_type(SQL_HANDLE_DBC, stmt->hdr.parent);
+ if (conn && conn->driver_odbc_ver < 0x300)
+ {
+ if (type == SQL_C_TYPE_TIME)
+ type = SQL_C_TIME;

View File

@@ -1,27 +1,28 @@
From 727dcdcc8c28c3d7e0aa46da46891978aed8a14a Mon Sep 17 00:00:00 2001
From 253834aebf96e3058dd04062b96422f19d82bb8f 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 | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
dlls/odbc32/proxyodbc.c | 21 +++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
index e1db8564f90..59015224cea 100644
index 1fb4c651e4c..f0d20bab02e 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -6331,6 +6331,9 @@ static SQLRETURN col_attribute_win32_w( struct statement *stmt, SQLUSMALLINT col
@@ -6485,6 +6485,10 @@ static SQLRETURN col_attribute_win32_w( struct statement *stmt, SQLUSMALLINT col
SQLPOINTER char_attr, SQLSMALLINT buflen, SQLSMALLINT *retlen,
SQLLEN *num_attr )
{
+ struct environment *env;
+ struct connection *conn;
+ 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 );
@@ -6391,11 +6394,23 @@ static SQLRETURN col_attribute_win32_w( struct statement *stmt, SQLUSMALLINT col
@@ -6545,11 +6549,24 @@ static SQLRETURN col_attribute_win32_w( struct statement *stmt, SQLUSMALLINT col
return SQL_ERROR;
}
@@ -30,8 +31,9 @@ index e1db8564f90..59015224cea 100644
retlen, num_attr );
+ /* Convert back for ODBC2 drivers */
+ env = (struct environment *)find_object_type(SQL_HANDLE_ENV, stmt->hdr.parent);
+ conn = (struct connection *)find_object_type(SQL_HANDLE_DBC, stmt->hdr.parent);
+ if (SQL_SUCCEEDED(ret) && num_attr && field_id == SQL_COLUMN_TYPE &&
+ env && env->attr_version == SQL_OV_ODBC3 && env->driver_ver == SQL_OV_ODBC2)
+ env && env->attr_version == SQL_OV_ODBC3 && conn && conn->driver_odbc_ver < 0x300)
+ {
+ if (*num_attr == SQL_TIME)
+ *num_attr = SQL_TYPE_TIME;
@@ -48,5 +50,5 @@ index e1db8564f90..59015224cea 100644
/*************************************************************************
--
2.50.1
2.51.0

View File

@@ -1,4 +1,4 @@
From 6906a9555d2410c326e3c1273052ee25a1156e1c Mon Sep 17 00:00:00 2001
From 5adaf024fbb6afb2a0f9f1db51df61105cdc3c17 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Tue, 29 Apr 2025 13:08:38 +1000
Subject: [PATCH] odbc32: SQLColAttributeW - Add ANSI fallback
@@ -8,10 +8,10 @@ Subject: [PATCH] odbc32: SQLColAttributeW - Add ANSI fallback
1 file changed, 37 insertions(+), 2 deletions(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
index 11a9633af82..d6946e1c66d 100644
index 8b74c2b3d5f..84a099bd4a0 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -6410,7 +6410,7 @@ static SQLRETURN col_attribute_win32_w( struct statement *stmt, SQLUSMALLINT col
@@ -6544,7 +6544,7 @@ static SQLRETURN col_attribute_win32_w( struct statement *stmt, SQLUSMALLINT col
return ret;
}
@@ -20,7 +20,7 @@ index 11a9633af82..d6946e1c66d 100644
{
if (buflen < 0) return SQL_ERROR;
if (!col)
@@ -6459,8 +6459,43 @@ static SQLRETURN col_attribute_win32_w( struct statement *stmt, SQLUSMALLINT col
@@ -6593,8 +6593,43 @@ static SQLRETURN col_attribute_win32_w( struct statement *stmt, SQLUSMALLINT col
FIXME( "field id %u not handled\n", field_id );
}
@@ -64,7 +64,7 @@ index 11a9633af82..d6946e1c66d 100644
+
/* Convert back for ODBC2 drivers */
env = (struct environment *)find_object_type(SQL_HANDLE_ENV, stmt->hdr.parent);
if (SQL_SUCCEEDED(ret) && num_attr && field_id == SQL_COLUMN_TYPE &&
conn = (struct connection *)find_object_type(SQL_HANDLE_DBC, stmt->hdr.parent);
--
2.50.1
2.51.0

View File

@@ -1 +1 @@
dc34fef45d491516fa8eaee45b2ae40faa7b0bfe
c1bafaa02329442df1aba576e2884c0ab699f76e