mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-09-13 09:17:20 -07:00
Updated odbc-remove-unixodbc patchset
Update SQLDriverConnectW to record the driver ODBC version it supports. Fixup SQLColAttribute/W return SQL_COLUMN_TYPE column type when driver v2.0 and ODBC 3.0 request.
This commit is contained in:
parent
8a93e0c0ef
commit
cdcfae0a00
@ -1,23 +1,24 @@
|
||||
From ad1448a074504eab53c3b465a7636abc1da42317 Mon Sep 17 00:00:00 2001
|
||||
From 64af6ff6f7ac46823bc98e5b70bff87c46652aab Mon Sep 17 00:00:00 2001
|
||||
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
||||
Date: Sat, 4 Feb 2023 09:16:29 +1100
|
||||
Subject: [PATCH] odbc32: Implement SQLDriverConnectW
|
||||
|
||||
---
|
||||
dlls/odbc32/proxyodbc.c | 359 +++++++++++++++++++++++++++++++++++++++-
|
||||
1 file changed, 357 insertions(+), 2 deletions(-)
|
||||
dlls/odbc32/proxyodbc.c | 367 +++++++++++++++++++++++++++++++++++++++-
|
||||
1 file changed, 365 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
|
||||
index 57cb27ed3c3..b610b604ca9 100644
|
||||
index 070f0197742..30baf1866a4 100644
|
||||
--- a/dlls/odbc32/proxyodbc.c
|
||||
+++ b/dlls/odbc32/proxyodbc.c
|
||||
@@ -53,10 +53,247 @@ struct SQLHDBC_data
|
||||
@@ -53,10 +53,248 @@ struct SQLHDBC_data
|
||||
{
|
||||
int type;
|
||||
struct SQLHENV_data *environment;
|
||||
+ HMODULE module;
|
||||
+ SQLHENV driver_env;
|
||||
+ SQLHDBC driver_hdbc;
|
||||
+ SQLHENV driver_env;
|
||||
+ SQLINTEGER driver_ver; /* ODBC version supported by driver */
|
||||
+ SQLHDBC driver_hdbc;
|
||||
+
|
||||
+ SQLRETURN (WINAPI *pSQLAllocConnect)(SQLHENV,SQLHDBC*);
|
||||
+ SQLRETURN (WINAPI *pSQLAllocEnv)(SQLHENV*);
|
||||
@ -259,7 +260,7 @@ index 57cb27ed3c3..b610b604ca9 100644
|
||||
/*************************************************************************
|
||||
* SQLAllocConnect [ODBC32.001]
|
||||
*/
|
||||
@@ -77,6 +314,7 @@ SQLRETURN WINAPI SQLAllocConnect(SQLHENV EnvironmentHandle, SQLHDBC *ConnectionH
|
||||
@@ -77,6 +315,7 @@ SQLRETURN WINAPI SQLAllocConnect(SQLHENV EnvironmentHandle, SQLHDBC *ConnectionH
|
||||
hdbc->type = SQL_HANDLE_DBC;
|
||||
hdbc->environment = EnvironmentHandle;
|
||||
hdbc->login_timeout = 0;
|
||||
@ -267,7 +268,7 @@ index 57cb27ed3c3..b610b604ca9 100644
|
||||
|
||||
*ConnectionHandle = hdbc;
|
||||
|
||||
@@ -438,6 +676,8 @@ SQLRETURN WINAPI SQLFreeConnect(SQLHDBC ConnectionHandle)
|
||||
@@ -438,6 +677,8 @@ SQLRETURN WINAPI SQLFreeConnect(SQLHDBC ConnectionHandle)
|
||||
return SQL_ERROR;
|
||||
}
|
||||
|
||||
@ -276,7 +277,7 @@ index 57cb27ed3c3..b610b604ca9 100644
|
||||
free(hdbc);
|
||||
|
||||
return SQL_SUCCESS;
|
||||
@@ -1596,6 +1836,65 @@ SQLRETURN WINAPI SQLColumnsW(SQLHSTMT StatementHandle, WCHAR *CatalogName, SQLSM
|
||||
@@ -1596,6 +1837,65 @@ SQLRETURN WINAPI SQLColumnsW(SQLHSTMT StatementHandle, WCHAR *CatalogName, SQLSM
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -342,7 +343,7 @@ index 57cb27ed3c3..b610b604ca9 100644
|
||||
/*************************************************************************
|
||||
* SQLDriverConnectW [ODBC32.141]
|
||||
*/
|
||||
@@ -1603,13 +1902,69 @@ SQLRETURN WINAPI SQLDriverConnectW(SQLHDBC ConnectionHandle, SQLHWND WindowHandl
|
||||
@@ -1603,13 +1903,76 @@ SQLRETURN WINAPI SQLDriverConnectW(SQLHDBC ConnectionHandle, SQLHWND WindowHandl
|
||||
SQLSMALLINT Length, WCHAR *OutConnectionString, SQLSMALLINT BufferLength,
|
||||
SQLSMALLINT *Length2, SQLUSMALLINT DriverCompletion)
|
||||
{
|
||||
@ -384,13 +385,20 @@ index 57cb27ed3c3..b610b604ca9 100644
|
||||
+ return SQL_ERROR;
|
||||
+
|
||||
+ connection->module = driver;
|
||||
+ connection->driver_ver = SQL_OV_ODBC2;
|
||||
+ connection_bind_sql_funcs(connection);
|
||||
+
|
||||
+ /* ODBC 3.x */
|
||||
+ if (connection->pSQLAllocHandle)
|
||||
+ {
|
||||
+ connection->pSQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &connection->driver_env);
|
||||
+ connection->pSQLAllocHandle(SQL_HANDLE_DBC, connection->driver_env, &connection->driver_hdbc);
|
||||
+
|
||||
+ if (connection->pSQLGetEnvAttr)
|
||||
+ connection->pSQLGetEnvAttr(connection->driver_env, SQL_ATTR_ODBC_VERSION, &connection->driver_ver, 0, NULL);
|
||||
+
|
||||
+ }
|
||||
+ /* ODBC 2.x */
|
||||
+ else if(connection->pSQLAllocConnect && connection->pSQLAllocEnv)
|
||||
+ {
|
||||
+ connection->pSQLAllocEnv(&connection->driver_env);
|
||||
|
@ -1,17 +1,17 @@
|
||||
From 8d90ba32bbd212d36cbdd47c595c76b4f324d4f8 Mon Sep 17 00:00:00 2001
|
||||
From 204e31dd1d93a967f57b35678e196c3271b2cd49 Mon Sep 17 00:00:00 2001
|
||||
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
||||
Date: Mon, 6 Feb 2023 15:13:09 +1100
|
||||
Subject: [PATCH 33/42] odbc32: Forward SQLGetData request onto driver
|
||||
Subject: [PATCH] odbc32: Forward SQLGetData request onto driver
|
||||
|
||||
---
|
||||
dlls/odbc32/proxyodbc.c | 16 +++++++++++++++-
|
||||
1 file changed, 15 insertions(+), 1 deletion(-)
|
||||
dlls/odbc32/proxyodbc.c | 26 +++++++++++++++++++++++++-
|
||||
1 file changed, 25 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
|
||||
index 7589ba7d9d4..4e98c8c7caa 100644
|
||||
index f7032a66ca6..c8e715bdd67 100644
|
||||
--- a/dlls/odbc32/proxyodbc.c
|
||||
+++ b/dlls/odbc32/proxyodbc.c
|
||||
@@ -926,11 +926,25 @@ SQLRETURN WINAPI SQLGetCursorName(SQLHSTMT StatementHandle, SQLCHAR *CursorName,
|
||||
@@ -922,11 +922,35 @@ SQLRETURN WINAPI SQLGetCursorName(SQLHSTMT StatementHandle, SQLCHAR *CursorName,
|
||||
SQLRETURN WINAPI SQLGetData(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber, SQLSMALLINT TargetType,
|
||||
SQLPOINTER TargetValue, SQLLEN BufferLength, SQLLEN *StrLen_or_Ind)
|
||||
{
|
||||
@ -30,6 +30,16 @@ index 7589ba7d9d4..4e98c8c7caa 100644
|
||||
+
|
||||
+ if (statement->connection->pSQLGetData)
|
||||
+ {
|
||||
+ if(statement->connection->driver_ver == SQL_OV_ODBC2 &&
|
||||
+ statement->connection->environment->version == SQL_OV_ODBC3)
|
||||
+ {
|
||||
+ if (TargetType == SQL_C_TYPE_TIME)
|
||||
+ TargetType = SQL_C_TIME;
|
||||
+ else if (TargetType == SQL_C_TYPE_DATE)
|
||||
+ TargetType = SQL_C_DATE;
|
||||
+ else if (TargetType == SQL_C_TYPE_TIMESTAMP)
|
||||
+ TargetType = SQL_C_TIMESTAMP;
|
||||
+ }
|
||||
+ ret = statement->connection->pSQLGetData(statement->driver_stmt, ColumnNumber, TargetType,
|
||||
+ TargetValue, BufferLength, StrLen_or_Ind);
|
||||
+ }
|
||||
@ -39,5 +49,5 @@ index 7589ba7d9d4..4e98c8c7caa 100644
|
||||
}
|
||||
|
||||
--
|
||||
2.39.1
|
||||
2.43.0
|
||||
|
||||
|
@ -1,28 +1,27 @@
|
||||
From e74193b1a57027b193e190fa41c5b85eee39e1b8 Mon Sep 17 00:00:00 2001
|
||||
From b05ebe79d74d84c7354cecb3072812697839a61f Mon Sep 17 00:00:00 2001
|
||||
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
||||
Date: Wed, 8 Feb 2023 09:03:40 +1100
|
||||
Subject: [PATCH] odbc32: Pass ODBC version when creating driver environment
|
||||
Subject: odbc32: Pass ODBC version when creating driver environment
|
||||
|
||||
---
|
||||
dlls/odbc32/proxyodbc.c | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
|
||||
index 901e2dca006..35ff5b7fc35 100644
|
||||
index d590a5af0fe..389148b625a 100644
|
||||
--- a/dlls/odbc32/proxyodbc.c
|
||||
+++ b/dlls/odbc32/proxyodbc.c
|
||||
@@ -2546,6 +2546,11 @@ SQLRETURN WINAPI SQLDriverConnectW(SQLHDBC ConnectionHandle, SQLHWND WindowHandl
|
||||
@@ -2644,11 +2644,15 @@ SQLRETURN WINAPI SQLDriverConnectW(SQLHDBC ConnectionHandle, SQLHWND WindowHandl
|
||||
if (connection->pSQLAllocHandle)
|
||||
{
|
||||
connection->pSQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &connection->driver_env);
|
||||
+
|
||||
- connection->pSQLAllocHandle(SQL_HANDLE_DBC, connection->driver_env, &connection->driver_hdbc);
|
||||
|
||||
if (connection->pSQLGetEnvAttr)
|
||||
connection->pSQLGetEnvAttr(connection->driver_env, SQL_ATTR_ODBC_VERSION, &connection->driver_ver, 0, NULL);
|
||||
|
||||
+ if (connection->pSQLSetEnvAttr)
|
||||
+ connection->pSQLSetEnvAttr(connection->driver_env, SQL_ATTR_ODBC_VERSION,
|
||||
+ (SQLPOINTER)connection->environment->version, 0);
|
||||
+
|
||||
connection->pSQLAllocHandle(SQL_HANDLE_DBC, connection->driver_env, &connection->driver_hdbc);
|
||||
+ connection->pSQLAllocHandle(SQL_HANDLE_DBC, connection->driver_env, &connection->driver_hdbc);
|
||||
}
|
||||
/* ODBC 2.x */
|
||||
else if(connection->pSQLAllocConnect && connection->pSQLAllocEnv)
|
||||
--
|
||||
2.43.0
|
||||
|
||||
|
@ -1,17 +1,54 @@
|
||||
From c6664bce748c7d66f6fa1aecd6c8ae30a7c5784f Mon Sep 17 00:00:00 2001
|
||||
From d3bfdb5fc584ae6a2bab70056f0cad11e4b741cd Mon Sep 17 00:00:00 2001
|
||||
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
||||
Date: Wed, 8 Feb 2023 20:19:44 +1100
|
||||
Subject: [PATCH] odbc32: Forward SQLColAttribute/W request onto driver
|
||||
|
||||
---
|
||||
dlls/odbc32/proxyodbc.c | 52 +++++++++++++++++++++++++++++++++++++++--
|
||||
1 file changed, 50 insertions(+), 2 deletions(-)
|
||||
dlls/odbc32/proxyodbc.c | 119 ++++++++++++++++++++++++++++++++++------
|
||||
1 file changed, 102 insertions(+), 17 deletions(-)
|
||||
|
||||
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
|
||||
index 7f3221ba124..dc61b2a5540 100644
|
||||
index 3eca2ce9999..25e8249f8fc 100644
|
||||
--- a/dlls/odbc32/proxyodbc.c
|
||||
+++ b/dlls/odbc32/proxyodbc.c
|
||||
@@ -556,12 +556,26 @@ SQLRETURN WINAPI SQLColAttribute(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNu
|
||||
@@ -314,6 +314,36 @@ static void connection_bind_sql_funcs(struct SQLHDBC_data *connection)
|
||||
LOAD_FUNCPTR(SQLTransact);
|
||||
}
|
||||
|
||||
+static SQLINTEGER map_odbc2_to_3(SQLINTEGER fieldid)
|
||||
+{
|
||||
+ switch( fieldid )
|
||||
+ {
|
||||
+ case SQL_COLUMN_COUNT:
|
||||
+ return SQL_DESC_COUNT;
|
||||
+ case SQL_COLUMN_NULLABLE:
|
||||
+ return SQL_DESC_NULLABLE;
|
||||
+ case SQL_COLUMN_NAME:
|
||||
+ return SQL_DESC_NAME;
|
||||
+ default:
|
||||
+ return fieldid;
|
||||
+ }
|
||||
+}
|
||||
+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;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+
|
||||
/*************************************************************************
|
||||
* SQLAllocConnect [ODBC32.001]
|
||||
*/
|
||||
@@ -557,12 +587,47 @@ SQLRETURN WINAPI SQLColAttribute(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNu
|
||||
SQLSMALLINT BufferLength, SQLSMALLINT *StringLength,
|
||||
SQLLEN *NumericAttribute)
|
||||
{
|
||||
@ -29,38 +66,60 @@ index 7f3221ba124..dc61b2a5540 100644
|
||||
+ return SQL_ERROR;
|
||||
+ }
|
||||
+
|
||||
+ /* ODBC 3.0 */
|
||||
+ if (statement->connection->pSQLColAttribute)
|
||||
+ {
|
||||
+ ret = statement->connection->pSQLColAttribute(statement->driver_stmt, ColumnNumber, FieldIdentifier,
|
||||
+ CharacterAttribute, BufferLength, StringLength, NumericAttribute);
|
||||
+ }
|
||||
+ /* ODBC 2.0 */
|
||||
+ else if (statement->connection->pSQLColAttributes)
|
||||
+ {
|
||||
+ FieldIdentifier = map_odbc3_to_2(FieldIdentifier);
|
||||
+ ret = statement->connection->pSQLColAttributes(statement->driver_stmt, ColumnNumber, FieldIdentifier,
|
||||
+ CharacterAttribute, BufferLength, StringLength, NumericAttribute);
|
||||
+
|
||||
+ /* Convert back for ODBC3 drivers */
|
||||
+ if (NumericAttribute && FieldIdentifier == SQL_COLUMN_TYPE &&
|
||||
+ statement->connection->driver_ver == SQL_OV_ODBC2 &&
|
||||
+ statement->connection->environment->version == SQL_OV_ODBC3)
|
||||
+ {
|
||||
+ if (*NumericAttribute == SQL_TIME)
|
||||
+ *NumericAttribute = SQL_TYPE_TIME;
|
||||
+ else if (*NumericAttribute == SQL_DATETIME)
|
||||
+ *NumericAttribute = SQL_TYPE_DATE;
|
||||
+ else if (*NumericAttribute == SQL_TIMESTAMP)
|
||||
+ *NumericAttribute = SQL_TYPE_TIMESTAMP;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ TRACE("ret %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -2017,6 +2031,20 @@ static SQLINTEGER map_odbc2_to_3(SQLINTEGER fieldid)
|
||||
return fieldid;
|
||||
}
|
||||
@@ -2063,21 +2128,6 @@ SQLRETURN WINAPI SQLSetScrollOptions(SQLHSTMT statement_handle, SQLUSMALLINT f_c
|
||||
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 SQLINTEGER map_odbc2_to_3(SQLINTEGER fieldid)
|
||||
-{
|
||||
- switch( fieldid )
|
||||
- {
|
||||
- case SQL_COLUMN_COUNT:
|
||||
- return SQL_DESC_COUNT;
|
||||
- case SQL_COLUMN_NULLABLE:
|
||||
- return SQL_DESC_NULLABLE;
|
||||
- case SQL_COLUMN_NAME:
|
||||
- return SQL_DESC_NAME;
|
||||
- default:
|
||||
- return fieldid;
|
||||
- }
|
||||
-}
|
||||
-
|
||||
/*************************************************************************
|
||||
* SQLColAttributesW [ODBC32.106]
|
||||
@@ -2224,12 +2252,32 @@ SQLRETURN WINAPI SQLColAttributeW(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnN
|
||||
*/
|
||||
@@ -2284,12 +2334,47 @@ SQLRETURN WINAPI SQLColAttributeW(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnN
|
||||
SQLSMALLINT BufferLength, SQLSMALLINT *StringLength,
|
||||
SQLLEN *NumericAttribute)
|
||||
{
|
||||
@ -78,16 +137,31 @@ index 7f3221ba124..dc61b2a5540 100644
|
||||
+ return SQL_ERROR;
|
||||
+ }
|
||||
+
|
||||
+ /* ODBC 3.0 */
|
||||
+ if (statement->connection->pSQLColAttributeW)
|
||||
+ {
|
||||
+ ret = statement->connection->pSQLColAttributeW(statement->driver_stmt, ColumnNumber, FieldIdentifier,
|
||||
+ CharacterAttribute, BufferLength, StringLength, NumericAttribute);
|
||||
+ }
|
||||
+ /* ODBC 2.0 */
|
||||
+ else if (statement->connection->pSQLColAttributesW)
|
||||
+ {
|
||||
+ FieldIdentifier = map_odbc3_to_2(FieldIdentifier);
|
||||
+ ret = statement->connection->pSQLColAttributesW(statement->driver_stmt, ColumnNumber, FieldIdentifier,
|
||||
+ CharacterAttribute, BufferLength, StringLength, NumericAttribute);
|
||||
+
|
||||
+ /* Convert back for ODBC3 drivers */
|
||||
+ if (NumericAttribute && FieldIdentifier == SQL_COLUMN_TYPE &&
|
||||
+ statement->connection->driver_ver == SQL_OV_ODBC2 &&
|
||||
+ statement->connection->environment->version == SQL_OV_ODBC3)
|
||||
+ {
|
||||
+ if (*NumericAttribute == SQL_TIME)
|
||||
+ *NumericAttribute = SQL_TYPE_TIME;
|
||||
+ else if (*NumericAttribute == SQL_DATETIME)
|
||||
+ *NumericAttribute = SQL_TYPE_DATE;
|
||||
+ else if (*NumericAttribute == SQL_TIMESTAMP)
|
||||
+ *NumericAttribute = SQL_TYPE_TIMESTAMP;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ TRACE("ret %d\n", ret);
|
||||
|
Loading…
Reference in New Issue
Block a user