Updated odbc-remove-unixodbc patchset

Add fallback for SQLSetStmtAttr/W to support ODBC 2.0.

SQLGetDiagField/W return SQL_NO_DATA as default.
This commit is contained in:
Alistair Leslie-Hughes 2024-06-10 15:39:48 +10:00
parent 9e8e2ae892
commit 1977f6c82a
6 changed files with 53 additions and 83 deletions

View File

@ -1,4 +1,4 @@
From 26584146fbac7cbb91cf497812033bfe0ab01445 Mon Sep 17 00:00:00 2001
From 47ce8ff5045c8983ac86c1aeda745230c86bc275 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Thu, 2 Feb 2023 14:20:44 +1100
Subject: [PATCH] odbc32: Remove unixODBC support
@ -14,10 +14,10 @@ Subject: [PATCH] odbc32: Remove unixODBC support
delete mode 100644 dlls/odbc32/unixlib.h
diff --git a/configure.ac b/configure.ac
index db3f14bb970..2cca343becc 100644
index 231ec7f17d6..c48ccfd809f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1428,16 +1428,6 @@ WINE_NOTICE_WITH(pcsclite,[test "x$PCSCLITE_LIBS" = x],
@@ -1426,16 +1426,6 @@ WINE_NOTICE_WITH(pcsclite,[test "x$PCSCLITE_LIBS" = x],
[libpcsclite not found, smart cards won't be supported.],
[enable_winscard])
@ -51,7 +51,7 @@ index 0ec0ae8eaf4..a42f1473d67 100644
- unixlib.c
+ rsrc.rc
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
index a3732c001be..0604d928366 100644
index a3732c001be..89e4545f068 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -40,36 +40,19 @@
@ -923,7 +923,7 @@ index a3732c001be..0604d928366 100644
- StringLength };
- struct handle *handle = Handle;
- SQLRETURN ret;
+ SQLRETURN ret = SQL_ERROR;
+ SQLRETURN ret = SQL_NO_DATA;
- TRACE("(HandleType %d, Handle %p, RecNumber %d, DiagIdentifier %d, DiagInfo %p, BufferLength %d,"
+ FIXME("(HandleType %d, Handle %p, RecNumber %d, DiagIdentifier %d, DiagInfo %p, BufferLength %d,"
@ -949,7 +949,7 @@ index a3732c001be..0604d928366 100644
- BufferLength, TextLength };
- struct handle *handle = Handle;
- SQLRETURN ret;
+ SQLRETURN ret = SQL_ERROR;
+ SQLRETURN ret = SQL_NO_DATA;
- TRACE("(HandleType %d, Handle %p, RecNumber %d, SqlState %p, NativeError %p, MessageText %p, BufferLength %d,"
- " TextLength %p)\n", HandleType, Handle, RecNumber, SqlState, NativeError, MessageText, BufferLength,
@ -2476,7 +2476,7 @@ index a3732c001be..0604d928366 100644
- StringLength };
- struct handle *handle = Handle;
- SQLRETURN ret;
+ SQLRETURN ret = SQL_ERROR;
+ SQLRETURN ret = SQL_NO_DATA;
- TRACE("(HandleType %d, Handle %p, RecNumber %d, DiagIdentifier %d, DiagInfo %p, BufferLength %d,"
+ FIXME("(HandleType %d, Handle %p, RecNumber %d, DiagIdentifier %d, DiagInfo %p, BufferLength %d,"

View File

@ -1,17 +1,17 @@
From eeab9933053871380bac92db0a9e7444be7f9374 Mon Sep 17 00:00:00 2001
From ae3542748782dea8b9213c0d015f09ac94c13bf9 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Mon, 6 Feb 2023 09:59:14 +1100
Subject: [PATCH 15/42] odbc32: Forward SQLSetStmtAttr/W request to driver
Subject: [PATCH] odbc32: Forward SQLSetStmtAttr/W request to driver
---
dlls/odbc32/proxyodbc.c | 30 ++++++++++++++++++++++++++++--
1 file changed, 28 insertions(+), 2 deletions(-)
dlls/odbc32/proxyodbc.c | 38 ++++++++++++++++++++++++++++++++++++--
1 file changed, 36 insertions(+), 2 deletions(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
index 4ec5ecfcb83..d0be7b600bf 100644
index b3b10917660..0f868331ac9 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -1242,11 +1242,24 @@ SQLRETURN WINAPI SQLSetParam(SQLHSTMT StatementHandle, SQLUSMALLINT ParameterNum
@@ -1265,11 +1265,28 @@ SQLRETURN WINAPI SQLSetParam(SQLHSTMT StatementHandle, SQLUSMALLINT ParameterNum
SQLRETURN WINAPI SQLSetStmtAttr(SQLHSTMT StatementHandle, SQLINTEGER Attribute, SQLPOINTER Value,
SQLINTEGER StringLength)
{
@ -32,12 +32,16 @@ index 4ec5ecfcb83..d0be7b600bf 100644
+ {
+ ret = statement->connection->pSQLSetStmtAttr(statement->driver_stmt, Attribute, Value, StringLength);
+ }
+ else if (statement->connection->pSQLSetStmtOption)
+ {
+ ret = statement->connection->pSQLSetStmtOption( statement->driver_stmt, Attribute, (SQLULEN) Value );
+ }
+
+ TRACE("ret %d\n", ret);
return ret;
}
@@ -2378,11 +2391,24 @@ SQLRETURN WINAPI SQLSetDescFieldW(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumb
@@ -2430,11 +2447,28 @@ SQLRETURN WINAPI SQLSetDescFieldW(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumb
SQLRETURN WINAPI SQLSetStmtAttrW(SQLHSTMT StatementHandle, SQLINTEGER Attribute, SQLPOINTER Value,
SQLINTEGER StringLength)
{
@ -58,11 +62,15 @@ index 4ec5ecfcb83..d0be7b600bf 100644
+ {
+ ret = statement->connection->pSQLSetStmtAttrW(statement->driver_stmt, Attribute, Value, StringLength);
+ }
+ else if (statement->connection->pSQLSetStmtOption)
+ {
+ ret = statement->connection->pSQLSetStmtOption( statement->driver_stmt, Attribute, (SQLULEN) Value );
+ }
+
+ TRACE("ret %d\n", ret);
return ret;
}
--
2.39.1
2.43.0

View File

@ -1,19 +1,19 @@
From 89c345e13d530c284be111076b5b17abb7d3487b Mon Sep 17 00:00:00 2001
From a760ceac67ab2ba73b7a5245793a9b720da3ec49 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Mon, 6 Feb 2023 13:15:48 +1100
Subject: [PATCH 30/42] odbc32: Forward SQLGetDiagField/W request onto driver
Subject: [PATCH] odbc32: Forward SQLGetDiagField/W request onto driver
---
dlls/odbc32/proxyodbc.c | 46 +++++++++++++++++++++++++++++++++++++++--
1 file changed, 44 insertions(+), 2 deletions(-)
dlls/odbc32/proxyodbc.c | 48 +++++++++++++++++++++++++++++++++++++++--
1 file changed, 46 insertions(+), 2 deletions(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
index 846b788b76b..74e5d70cfef 100644
index 407da1e4c1a..cc907f4fc2e 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -963,9 +963,30 @@ SQLRETURN WINAPI SQLGetDiagField(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSM
@@ -958,9 +958,31 @@ SQLRETURN WINAPI SQLGetDiagField(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSM
{
SQLRETURN ret = SQL_ERROR;
SQLRETURN ret = SQL_NO_DATA;
- FIXME("(HandleType %d, Handle %p, RecNumber %d, DiagIdentifier %d, DiagInfo %p, BufferLength %d,"
+ TRACE("(HandleType %d, Handle %p, RecNumber %d, DiagIdentifier %d, DiagInfo %p, BufferLength %d,"
@ -40,12 +40,13 @@ index 846b788b76b..74e5d70cfef 100644
+ DiagIdentifier, DiagInfo, BufferLength, StringLength);
+ }
+
+ TRACE("ret %d\n", ret);
return ret;
}
@@ -2131,9 +2152,30 @@ SQLRETURN WINAPI SQLGetDiagFieldW(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLS
@@ -2166,9 +2188,31 @@ SQLRETURN WINAPI SQLGetDiagFieldW(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLS
{
SQLRETURN ret = SQL_ERROR;
SQLRETURN ret = SQL_NO_DATA;
- FIXME("(HandleType %d, Handle %p, RecNumber %d, DiagIdentifier %d, DiagInfo %p, BufferLength %d,"
+ TRACE("(HandleType %d, Handle %p, RecNumber %d, DiagIdentifier %d, DiagInfo %p, BufferLength %d,"
@ -72,9 +73,10 @@ index 846b788b76b..74e5d70cfef 100644
+ DiagIdentifier, DiagInfo, BufferLength, StringLength);
+ }
+
+ TRACE("ret %d\n", ret);
return ret;
}
--
2.39.1
2.43.0

View File

@ -1,25 +1,25 @@
From ce7011a2e2ef487f3c11b8c5d2328a7618b70ae7 Mon Sep 17 00:00:00 2001
From 9023d5ee59640a56a4015db678e9630e32d168b6 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Mon, 6 Feb 2023 14:11:44 +1100
Subject: [PATCH] odbc32: Forward SQLSetDescFieldW request onto driver
---
dlls/odbc32/proxyodbc.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
dlls/odbc32/proxyodbc.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
index 39d509c28e1..921729d7c22 100644
index d06683f1852..4ea07470b05 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -2212,6 +2212,7 @@ SQLRETURN WINAPI SQLGetDiagFieldW(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLS
ret = statement->connection->pSQLGetDiagFieldW(HandleType, statement->driver_stmt, RecNumber,
DiagIdentifier, DiagInfo, BufferLength, StringLength);
@@ -2185,6 +2185,7 @@ SQLRETURN WINAPI SQLGetConnectAttrW(SQLHDBC ConnectionHandle, SQLINTEGER Attribu
{
ret = connection->pSQLGetConnectOptionW(connection->driver_hdbc, Attribute, Value);
}
+ TRACE("ret %d\n", ret);
return ret;
}
@@ -2784,12 +2785,18 @@ SQLRETURN WINAPI SQLDriversW(SQLHENV EnvironmentHandle, SQLUSMALLINT fDirection,
TRACE("ret %d\n", ret);
@@ -2852,11 +2853,17 @@ SQLRETURN WINAPI SQLDriversW(SQLHENV EnvironmentHandle, SQLUSMALLINT fDirection,
SQLRETURN WINAPI SQLSetDescFieldW(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier,
SQLPOINTER Value, SQLINTEGER BufferLength)
{
@ -30,16 +30,14 @@ index 39d509c28e1..921729d7c22 100644
+ TRACE("(DescriptorHandle %p, RecNumber %d, FieldIdentifier %d, Value %p, BufferLength %d)\n", DescriptorHandle,
RecNumber, FieldIdentifier, Value, BufferLength);
- return ret;
+ if (hdesc->parent->connection->pSQLSetDescFieldW)
+ ret = hdesc->parent->connection->pSQLSetDescFieldW(hdesc->driver_hdesc, RecNumber, FieldIdentifier,
+ Value, BufferLength);
+ TRACE("ret %d\n", ret);
+
+ return ret;
return ret;
}
/*************************************************************************
--
2.43.0

View File

@ -1,17 +1,17 @@
From 5188be5a843ab3d340dd3b5b92e1448e27bf0104 Mon Sep 17 00:00:00 2001
From 2d319fb624bf217beded8f6e40b942331ea7670d Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Wed, 8 Feb 2023 21:03:47 +1100
Subject: [PATCH] odbc32: Forward SQLGetDiagRec request to driver
---
dlls/odbc32/proxyodbc.c | 62 +++++++++++++++++++++++++++++++++++++++--
1 file changed, 60 insertions(+), 2 deletions(-)
dlls/odbc32/proxyodbc.c | 34 +++++++++++++++++++++++++++++++++-
1 file changed, 33 insertions(+), 1 deletion(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
index 4b276b63803..f4798febbf1 100644
index 5389579d3ae..ab843b9ecb9 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -1068,10 +1068,42 @@ SQLRETURN WINAPI SQLGetDiagRec(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMAL
@@ -3147,9 +3147,41 @@ SQLRETURN WINAPI SQLGetDiagRecA(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMA
{
SQLRETURN ret = SQL_ERROR;
@ -51,47 +51,9 @@ index 4b276b63803..f4798febbf1 100644
+ {
+ TRACE("%d: %s %s\n", RecNumber, Sqlstate, MessageText);
+ }
+
return ret;
}
@@ -3030,9 +3062,35 @@ SQLRETURN WINAPI SQLGetDiagRecA(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMA
{
SQLRETURN ret = SQL_ERROR;
- FIXME("(HandleType %d, Handle %p, RecNumber %d, Sqlstate %p, NativeError %p, MessageText %p, BufferLength %d,"
+ TRACE("(HandleType %d, Handle %p, RecNumber %d, Sqlstate %p, NativeError %p, MessageText %p, BufferLength %d,"
" TextLength %p)\n", HandleType, Handle, RecNumber, Sqlstate, NativeError, MessageText, BufferLength,
TextLength);
+ if (HandleType == SQL_HANDLE_ENV)
+ {
+ FIXME("Unhandled SQL_HANDLE_ENV records\n");
+ }
+ else if (HandleType == SQL_HANDLE_DBC)
+ {
+ struct SQLHDBC_data *hdbc = Handle;
+
+ if (hdbc->pSQLGetDiagRecA)
+ ret = hdbc->pSQLGetDiagRecA(HandleType, hdbc->driver_hdbc, RecNumber, Sqlstate,
+ NativeError, MessageText, BufferLength, TextLength);
+ }
+ else if (HandleType == SQL_HANDLE_STMT)
+ {
+ struct SQLHSTMT_data *statement = Handle;
+
+ if (statement->connection->pSQLGetDiagRecA)
+ ret = statement->connection->pSQLGetDiagRecA(HandleType, statement->driver_stmt, RecNumber,
+ Sqlstate, NativeError, MessageText, BufferLength, TextLength);
+ }
+
+ if (ret != SQL_ERROR)
+ {
+ TRACE("%d: %s %s\n", RecNumber, Sqlstate, MessageText);
+ }
+
return ret;
}
--
2.42.0
2.43.0

View File

@ -38,7 +38,7 @@ index 5ee63893e06..32d061411e5 100644
+ }
+
+ TRACE("ret %d\n", ret);
+ return ret;
+
+
return ret;
}