From 7ab0b0f5f5d2b857595eb86866d31d31a625f623 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Wed, 4 Oct 2023 15:11:28 +1100 Subject: [PATCH] Updated odbc-remove-unixodbc patchset --- ...-SQLExecDirect-W-request-onto-driver.patch | 2 +- ...ward-SQLGetDiagRec-request-to-driver.patch | 97 +++++++++++++++++++ ...rd-SQLPrimaryKeysW-request-to-driver.patch | 46 +++++++++ ...ard-SQLStatisticsW-request-to-driver.patch | 48 +++++++++ 4 files changed, 192 insertions(+), 1 deletion(-) create mode 100644 patches/odbc-remove-unixodbc/0044-odbc32-Forward-SQLGetDiagRec-request-to-driver.patch create mode 100644 patches/odbc-remove-unixodbc/0045-odbc32-Forward-SQLPrimaryKeysW-request-to-driver.patch create mode 100644 patches/odbc-remove-unixodbc/0046-odbc32-Forward-SQLStatisticsW-request-to-driver.patch diff --git a/patches/odbc-remove-unixodbc/0017-odbc32-Forward-SQLExecDirect-W-request-onto-driver.patch b/patches/odbc-remove-unixodbc/0017-odbc32-Forward-SQLExecDirect-W-request-onto-driver.patch index 186b86ab..f0f4be64 100644 --- a/patches/odbc-remove-unixodbc/0017-odbc32-Forward-SQLExecDirect-W-request-onto-driver.patch +++ b/patches/odbc-remove-unixodbc/0017-odbc32-Forward-SQLExecDirect-W-request-onto-driver.patch @@ -18,7 +18,7 @@ index 10de992e83e..bbcaa2487db 100644 - FIXME("(StatementHandle %p, StatementText %s, TextLength %d)\n", StatementHandle, - debugstr_an((const char *)StatementText, TextLength), TextLength); + TRACE("(StatementHandle %p, StatementText %s, TextLength %d)\n", StatementHandle, -+ TextLength > 0 ? debugstr_wn(StatementText, TextLength) : debugstr_w(StatementText), ++ TextLength > 0 ? debugstr_an((char*)StatementText, TextLength) : debugstr_a((char*)StatementText), + TextLength); + + if (statement->type != SQL_HANDLE_STMT) diff --git a/patches/odbc-remove-unixodbc/0044-odbc32-Forward-SQLGetDiagRec-request-to-driver.patch b/patches/odbc-remove-unixodbc/0044-odbc32-Forward-SQLGetDiagRec-request-to-driver.patch new file mode 100644 index 00000000..a2eef30e --- /dev/null +++ b/patches/odbc-remove-unixodbc/0044-odbc32-Forward-SQLGetDiagRec-request-to-driver.patch @@ -0,0 +1,97 @@ +From 5188be5a843ab3d340dd3b5b92e1448e27bf0104 Mon Sep 17 00:00:00 2001 +From: Alistair Leslie-Hughes +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(-) + +diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c +index 4b276b63803..f4798febbf1 100644 +--- a/dlls/odbc32/proxyodbc.c ++++ b/dlls/odbc32/proxyodbc.c +@@ -1068,10 +1068,42 @@ SQLRETURN WINAPI SQLGetDiagRec(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMAL + { + 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->pSQLGetDiagRec) ++ ret = hdbc->pSQLGetDiagRec(HandleType, hdbc->driver_hdbc, RecNumber, Sqlstate, ++ NativeError, MessageText, BufferLength, TextLength); ++ else 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->pSQLGetDiagRec) ++ ret = statement->connection->pSQLGetDiagRec(HandleType, statement->driver_stmt, RecNumber, ++ Sqlstate, NativeError, MessageText, BufferLength, TextLength); ++ else 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; + } + +@@ -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 + diff --git a/patches/odbc-remove-unixodbc/0045-odbc32-Forward-SQLPrimaryKeysW-request-to-driver.patch b/patches/odbc-remove-unixodbc/0045-odbc32-Forward-SQLPrimaryKeysW-request-to-driver.patch new file mode 100644 index 00000000..32b474db --- /dev/null +++ b/patches/odbc-remove-unixodbc/0045-odbc32-Forward-SQLPrimaryKeysW-request-to-driver.patch @@ -0,0 +1,46 @@ +From ef625c118f33b0056161d72e8caabe9dc76fca31 Mon Sep 17 00:00:00 2001 +From: Alistair Leslie-Hughes +Date: Wed, 4 Oct 2023 15:09:56 +1100 +Subject: [PATCH] odbc32: Forward SQLPrimaryKeysW request to driver. + +--- + dlls/odbc32/proxyodbc.c | 16 +++++++++++++++- + 1 file changed, 15 insertions(+), 1 deletion(-) + +diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c +index f4798febbf1..5ee63893e06 100644 +--- a/dlls/odbc32/proxyodbc.c ++++ b/dlls/odbc32/proxyodbc.c +@@ -2927,14 +2927,28 @@ SQLRETURN WINAPI SQLPrimaryKeysW(SQLHSTMT hstmt, SQLWCHAR *szCatalogName, SQLSMA + SQLWCHAR *szSchemaName, SQLSMALLINT cbSchemaName, SQLWCHAR *szTableName, + SQLSMALLINT cbTableName) + { ++ struct SQLHSTMT_data *statement = hstmt; + SQLRETURN ret = SQL_ERROR; + +- FIXME("(hstmt %p, szCatalogName %s, cbCatalogName %d, szSchemaName %s, cbSchemaName %d, szTableName %s," ++ TRACE("(hstmt %p, szCatalogName %s, cbCatalogName %d, szSchemaName %s, cbSchemaName %d, szTableName %s," + " cbTableName %d)\n", hstmt, + debugstr_wn(szCatalogName, cbCatalogName), cbCatalogName, + debugstr_wn(szSchemaName, cbSchemaName), cbSchemaName, + debugstr_wn(szTableName, cbTableName), cbTableName); + ++ if (statement->type != SQL_HANDLE_STMT) ++ { ++ WARN("Wrong handle type %d\n", statement->type); ++ return SQL_ERROR; ++ } ++ ++ if (statement->connection->pSQLPrimaryKeysW) ++ { ++ ret = statement->connection->pSQLPrimaryKeysW(statement->driver_stmt, szCatalogName, ++ cbCatalogName, szSchemaName, cbSchemaName, szTableName, cbTableName); ++ } ++ ++ TRACE("ret %d\n", ret); + return ret; + } + +-- +2.42.0 + diff --git a/patches/odbc-remove-unixodbc/0046-odbc32-Forward-SQLStatisticsW-request-to-driver.patch b/patches/odbc-remove-unixodbc/0046-odbc32-Forward-SQLStatisticsW-request-to-driver.patch new file mode 100644 index 00000000..21582de3 --- /dev/null +++ b/patches/odbc-remove-unixodbc/0046-odbc32-Forward-SQLStatisticsW-request-to-driver.patch @@ -0,0 +1,48 @@ +From 851b22050c35cc6a94bd2d19f509b5402f9cacd1 Mon Sep 17 00:00:00 2001 +From: Alistair Leslie-Hughes +Date: Wed, 4 Oct 2023 15:30:49 +1100 +Subject: [PATCH] odbc32: Forward SQLStatisticsW request to driver. + +--- + dlls/odbc32/proxyodbc.c | 19 ++++++++++++++++++- + 1 file changed, 18 insertions(+), 1 deletion(-) + +diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c +index 5ee63893e06..32d061411e5 100644 +--- a/dlls/odbc32/proxyodbc.c ++++ b/dlls/odbc32/proxyodbc.c +@@ -2791,13 +2791,30 @@ SQLRETURN WINAPI SQLStatisticsW(SQLHSTMT StatementHandle, SQLWCHAR *CatalogName, + SQLWCHAR *SchemaName, SQLSMALLINT NameLength2, SQLWCHAR *TableName, + SQLSMALLINT NameLength3, SQLUSMALLINT Unique, SQLUSMALLINT Reserved) + { ++ struct SQLHSTMT_data *statement = StatementHandle; + SQLRETURN ret = SQL_ERROR; + +- FIXME("(StatementHandle %p, CatalogName %s, NameLength1 %d SchemaName %s, NameLength2 %d, TableName %s" ++ TRACE("(StatementHandle %p, CatalogName %s, NameLength1 %d SchemaName %s, NameLength2 %d, TableName %s" + " NameLength3 %d, Unique %d, Reserved %d)\n", StatementHandle, + debugstr_wn(CatalogName, NameLength1), NameLength1, debugstr_wn(SchemaName, NameLength2), NameLength2, + debugstr_wn(TableName, NameLength3), NameLength3, Unique, Reserved); + ++ if (statement->type != SQL_HANDLE_STMT) ++ { ++ WARN("Wrong handle type %d\n", statement->type); ++ return SQL_ERROR; ++ } ++ ++ if (statement->connection->pSQLStatisticsW) ++ { ++ ret = statement->connection->pSQLStatisticsW(statement->driver_stmt, CatalogName, ++ NameLength1, SchemaName, NameLength2, TableName, NameLength3, ++ Unique, Reserved); ++ } ++ ++ TRACE("ret %d\n", ret); ++ return ret; ++ + return ret; + } + +-- +2.42.0 +