Remove odbc-remove-unixodbc patchset

odbc32-fixes has all the changes required to make ODBC v2 drivers work.
This commit is contained in:
Alistair Leslie-Hughes 2024-07-29 07:43:06 +10:00
parent 6883402dec
commit db14a7bed3
50 changed files with 0 additions and 11528 deletions

View File

@ -1,54 +0,0 @@
From 54841f013e3f88c885ad4bc252083e6aa5958472 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Sun, 23 Jun 2024 16:45:43 +1000
Subject: [PATCH] wineodbc: Register as Driver
---
dlls/wineodbc/rsrc.rc | 3 +++
dlls/wineodbc/wineodbc.rgs | 23 +++++++++++++++++++++++
2 files changed, 26 insertions(+)
create mode 100644 dlls/wineodbc/wineodbc.rgs
diff --git a/dlls/wineodbc/rsrc.rc b/dlls/wineodbc/rsrc.rc
index b8fad8fe35b..9bc9d2934ab 100644
--- a/dlls/wineodbc/rsrc.rc
+++ b/dlls/wineodbc/rsrc.rc
@@ -24,3 +24,6 @@
#define WINE_PRODUCTVERSION_STR "3.520.6301.0"
#include "wine/wine_common_ver.rc"
+
+/* @makedep: wineodbc.rgs */
+1 WINE_REGISTRY wineodbc.rgs
diff --git a/dlls/wineodbc/wineodbc.rgs b/dlls/wineodbc/wineodbc.rgs
new file mode 100644
index 00000000000..c83d37976d7
--- /dev/null
+++ b/dlls/wineodbc/wineodbc.rgs
@@ -0,0 +1,23 @@
+HKLM
+{
+ NoRemove Software
+ {
+ NoRemove ODBC
+ {
+ NoRemove ODBCINST.INI
+ {
+ 'Wine ODBC Driver'
+ {
+ val 'Driver' = s '%MODULE%'
+ val 'DriverODBCVer' = s '03.50'
+ val 'Setup' = s '%MODULE%'
+ }
+
+ NoRemove ODBC Drivers
+ {
+ val 'Wine ODBC Driver' = s 'Installed'
+ }
+ }
+ }
+ }
+}
--
2.43.0

View File

@ -1,74 +0,0 @@
From 4f4f45e8aad723b7372d422f01df15e2320d23d6 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Fri, 3 Feb 2023 11:44:19 +1100
Subject: [PATCH] odbc32: Implement SQLAllocEnv/SQLFreeEnv
---
dlls/odbc32/proxyodbc.c | 31 +++++++++++++++++++++++++------
1 file changed, 25 insertions(+), 6 deletions(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
index 89e4545f068..48ba33bb0f5 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -43,6 +43,11 @@
WINE_DEFAULT_DEBUG_CHANNEL(odbc);
+struct SQLHENV_data
+{
+ int type;
+};
+
/*************************************************************************
* SQLAllocConnect [ODBC32.001]
@@ -61,13 +66,23 @@ SQLRETURN WINAPI SQLAllocConnect(SQLHENV EnvironmentHandle, SQLHDBC *ConnectionH
*/
SQLRETURN WINAPI SQLAllocEnv(SQLHENV *EnvironmentHandle)
{
- SQLRETURN ret = SQL_ERROR;
+ struct SQLHENV_data *henv;
- FIXME("(EnvironmentHandle %p)\n", EnvironmentHandle);
+ TRACE("(EnvironmentHandle %p)\n", EnvironmentHandle);
+
+ if (!EnvironmentHandle)
+ return SQL_ERROR;
*EnvironmentHandle = SQL_NULL_HENV;
+ henv = calloc(1, sizeof(*henv));
+ if (!henv)
+ return SQL_ERROR;
- return ret;
+ henv->type = SQL_HANDLE_ENV;
+
+ *EnvironmentHandle = henv;
+
+ return SQL_SUCCESS;
}
/*************************************************************************
@@ -399,11 +414,15 @@ SQLRETURN WINAPI SQLFreeConnect(SQLHDBC ConnectionHandle)
*/
SQLRETURN WINAPI SQLFreeEnv(SQLHENV EnvironmentHandle)
{
- SQLRETURN ret = SQL_ERROR;
+ struct SQLHENV_data *data = EnvironmentHandle;
+ TRACE("(EnvironmentHandle %p)\n", EnvironmentHandle);
- FIXME("(EnvironmentHandle %p)\n", EnvironmentHandle);
+ if (data && data->type != SQL_HANDLE_ENV)
+ WARN("EnvironmentHandle isn't of type SQL_HANDLE_ENV\n");
+ else
+ free(data);
- return ret;
+ return SQL_SUCCESS;
}
/*************************************************************************
--
2.43.0

View File

@ -1,114 +0,0 @@
From 35c784055b2af9d8d19f69f1d46bb257d9a70de3 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Fri, 3 Feb 2023 13:41:20 +1100
Subject: [PATCH] odbc32: Support SQL_ATTR_CONNECTION_POOLING in
SQLGetEnvAttr/SQLSetEnvAttr
---
dlls/odbc32/proxyodbc.c | 63 +++++++++++++++++++++++++++++++++++++----
1 file changed, 57 insertions(+), 6 deletions(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
index 48ba33bb0f5..89b8663d888 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -46,6 +46,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(odbc);
struct SQLHENV_data
{
int type;
+ SQLUINTEGER pooling;
};
@@ -79,6 +80,7 @@ SQLRETURN WINAPI SQLAllocEnv(SQLHENV *EnvironmentHandle)
return SQL_ERROR;
henv->type = SQL_HANDLE_ENV;
+ henv->pooling = SQL_CP_OFF;
*EnvironmentHandle = henv;
@@ -571,12 +573,42 @@ SQLRETURN WINAPI SQLGetDiagRec(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMAL
SQLRETURN WINAPI SQLGetEnvAttr(SQLHENV EnvironmentHandle, SQLINTEGER Attribute, SQLPOINTER Value,
SQLINTEGER BufferLength, SQLINTEGER *StringLength)
{
- SQLRETURN ret = SQL_ERROR;
+ struct SQLHENV_data *data = EnvironmentHandle;
- FIXME("(EnvironmentHandle %p, Attribute %d, Value %p, BufferLength %d, StringLength %p)\n",
+ TRACE("(EnvironmentHandle %p, Attribute %d, Value %p, BufferLength %d, StringLength %p)\n",
EnvironmentHandle, Attribute, Value, BufferLength, StringLength);
- return ret;
+ if (EnvironmentHandle == SQL_NULL_HENV)
+ {
+ if (StringLength)
+ *StringLength = 0;
+ if (Value)
+ *(SQLINTEGER*)Value = 0;
+ return SQL_SUCCESS;
+ }
+
+ if (data->type != SQL_HANDLE_ENV)
+ {
+ WARN("Wrong handle type %d\n", data->type);
+ return SQL_ERROR;
+ }
+
+ switch (Attribute)
+ {
+ case SQL_ATTR_CONNECTION_POOLING:
+ if (BufferLength != sizeof(data->pooling))
+ {
+ WARN("Invalid buffer size\n");
+ return SQL_ERROR;
+ }
+ *(SQLUINTEGER*)Value = data->pooling;
+ break;
+ default:
+ FIXME("Unhandle attribute %d\n", Attribute);
+ return SQL_ERROR;
+ }
+
+ return SQL_SUCCESS;
}
/*************************************************************************
@@ -785,12 +817,31 @@ SQLRETURN WINAPI SQLSetDescRec(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber,
SQLRETURN WINAPI SQLSetEnvAttr(SQLHENV EnvironmentHandle, SQLINTEGER Attribute, SQLPOINTER Value,
SQLINTEGER StringLength)
{
- SQLRETURN ret = SQL_ERROR;
+ struct SQLHENV_data *data = EnvironmentHandle;
- FIXME("(EnvironmentHandle %p, Attribute %d, Value %p, StringLength %d)\n", EnvironmentHandle, Attribute, Value,
+ TRACE("(EnvironmentHandle %p, Attribute %d, Value %p, StringLength %d)\n", EnvironmentHandle, Attribute, Value,
StringLength);
- return ret;
+ if(!data || data->type != SQL_HANDLE_ENV)
+ {
+ WARN("Wrong handle type %d\n", data->type);
+ return SQL_ERROR;
+ }
+
+ switch(Attribute)
+ {
+ case SQL_ATTR_CONNECTION_POOLING:
+ if (Value)
+ data->pooling = (uintptr_t)Value;
+ else
+ data->pooling = SQL_CP_OFF;
+ break;
+ default:
+ FIXME("Unhandle attribute %d\n", Attribute);
+ return SQL_ERROR;
+ }
+
+ return SQL_SUCCESS;
}
/*************************************************************************
--
2.43.0

View File

@ -1,101 +0,0 @@
From 4e1a78cfdba25f67e93f40ce9d4881cd15abf180 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Fri, 3 Feb 2023 14:16:21 +1100
Subject: [PATCH] odbc32: Add initial tests
---
dlls/odbc32/tests/odbc32.c | 52 +++++++++++++++++++++++++++++++++++++-
1 file changed, 51 insertions(+), 1 deletion(-)
diff --git a/dlls/odbc32/tests/odbc32.c b/dlls/odbc32/tests/odbc32.c
index 57bb17ef617..fa877c295d1 100644
--- a/dlls/odbc32/tests/odbc32.c
+++ b/dlls/odbc32/tests/odbc32.c
@@ -28,7 +28,7 @@
static void test_SQLAllocHandle( void )
{
SQLHANDLE handle;
- SQLHENV env;
+ SQLHENV env, env2;
SQLHDBC con;
SQLRETURN ret;
@@ -46,6 +46,12 @@ static void test_SQLAllocHandle( void )
ok( ret == SQL_SUCCESS, "got %d\n", ret );
ok( env != (void *)0xdeadbeef, "env not set\n" );
+ env2 = (void *)0xdeadbeef;
+ ret = SQLAllocEnv( &env2 );
+ ok( ret == SQL_SUCCESS, "got %d\n", ret );
+ ok( env2 != (void *)0xdeadbeef, "env2 not set\n" );
+ ok( env2 != env, "environment is the same\n" );
+
con = (void *)0xdeadbeef;
ret = SQLAllocConnect( env, &con );
ok( ret == SQL_SUCCESS, "got %d\n", ret );
@@ -57,6 +63,8 @@ static void test_SQLAllocHandle( void )
ok( ret == SQL_INVALID_HANDLE, "got %d\n", ret );
ret = SQLFreeEnv( env );
ok( ret == SQL_SUCCESS, "got %d\n", ret );
+ ret = SQLFreeEnv( env2 );
+ ok( ret == SQL_SUCCESS, "got %d\n", ret );
ret = SQLFreeEnv( 0 );
ok( ret == SQL_INVALID_HANDLE, "got %d\n", ret );
}
@@ -393,6 +401,47 @@ static void test_SQLExecDirect( void )
ok( ret == SQL_SUCCESS, "got %d\n", ret );
}
+void test_SQLGetEnvAttr(void)
+{
+ SQLRETURN ret;
+ SQLHENV sqlenv;
+ SQLINTEGER value, length;
+
+ ret = SQLAllocEnv(&sqlenv);
+ ok(ret == SQL_SUCCESS, "got %d\n", ret);
+
+ value = 5;
+ length = 12;
+ ret = SQLGetEnvAttr(SQL_NULL_HENV, SQL_ATTR_CONNECTION_POOLING, &value, sizeof(SQLINTEGER), &length);
+ ok(ret == SQL_SUCCESS, "got %d\n", ret);
+ ok(value == 0, "got %d\n", value);
+ todo_wine ok(length == 12, "got %d\n", length);
+
+ value = 5;
+ length = 13;
+ ret = SQLGetEnvAttr(SQL_NULL_HENV, SQL_ATTR_CONNECTION_POOLING, &value, 0, &length);
+ ok(ret == SQL_SUCCESS, "got %d\n", ret);
+ ok(value == 0, "got %d\n", value);
+ todo_wine ok(length == 13, "got %d\n", length);
+
+ value = 5;
+ length = 12;
+ ret = SQLGetEnvAttr(sqlenv, SQL_ATTR_CONNECTION_POOLING, &value, sizeof(SQLINTEGER), &length);
+ ok(ret == SQL_SUCCESS, "got %d\n", ret);
+ ok(value == 0, "got %d\n", value);
+ ok(length == 12, "got %d\n", length);
+
+ value = 5;
+ length = 12;
+ ret = SQLGetEnvAttr(sqlenv, SQL_ATTR_CONNECTION_POOLING, &value, 2, &length);
+ todo_wine ok(ret == SQL_SUCCESS, "got %d\n", ret);
+ todo_wine ok(value == 0, "got %d\n", value);
+ ok(length == 12, "got %d\n", length);
+
+ ret = SQLFreeEnv(sqlenv);
+ ok(ret == SQL_SUCCESS, "got %d\n", ret);
+}
+
START_TEST(odbc32)
{
test_SQLAllocHandle();
@@ -400,4 +449,5 @@ START_TEST(odbc32)
test_SQLDataSources();
test_SQLDrivers();
test_SQLExecDirect();
+ test_SQLGetEnvAttr();
}
--
2.43.0

View File

@ -1,81 +0,0 @@
From 0f67768bd11cc1c58d9ad84640260e2ea66ea8ff Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Fri, 3 Feb 2023 14:40:03 +1100
Subject: [PATCH] odbc32: Implement SQLAllocConnect
---
dlls/odbc32/proxyodbc.c | 41 +++++++++++++++++++++++++++++++++++------
1 file changed, 35 insertions(+), 6 deletions(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
index 89b8663d888..8cc89f2c7ba 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -49,17 +49,35 @@ struct SQLHENV_data
SQLUINTEGER pooling;
};
+struct SQLHDBC_data
+{
+ int type;
+ struct SQLHENV_data *environment;
+};
/*************************************************************************
* SQLAllocConnect [ODBC32.001]
*/
SQLRETURN WINAPI SQLAllocConnect(SQLHENV EnvironmentHandle, SQLHDBC *ConnectionHandle)
{
- SQLRETURN ret = SQL_ERROR;
+ struct SQLHDBC_data *hdbc;
+
+ TRACE("(EnvironmentHandle %p, ConnectionHandle %p)\n", EnvironmentHandle, ConnectionHandle);
- FIXME("(EnvironmentHandle %p, ConnectionHandle %p)\n", EnvironmentHandle, ConnectionHandle);
+ if(!ConnectionHandle)
+ return SQL_ERROR;
*ConnectionHandle = SQL_NULL_HDBC;
- return ret;
+
+ hdbc = calloc(1, sizeof(*hdbc));
+ if (!hdbc)
+ return SQL_ERROR;
+
+ hdbc->type = SQL_HANDLE_DBC;
+ hdbc->environment = EnvironmentHandle;
+
+ *ConnectionHandle = hdbc;
+
+ return SQL_SUCCESS;
}
/*************************************************************************
@@ -404,11 +422,22 @@ SQLRETURN WINAPI SQLFetchScroll(SQLHSTMT StatementHandle, SQLSMALLINT FetchOrien
*/
SQLRETURN WINAPI SQLFreeConnect(SQLHDBC ConnectionHandle)
{
- SQLRETURN ret = SQL_ERROR;
+ struct SQLHDBC_data *hdbc = ConnectionHandle;
- FIXME("(ConnectionHandle %p)\n", ConnectionHandle);
+ TRACE("(ConnectionHandle %p)\n", ConnectionHandle);
- return ret;
+ if (!hdbc)
+ return SQL_ERROR;
+
+ if (hdbc->type != SQL_HANDLE_DBC)
+ {
+ WARN("Wrong handle type %d\n", hdbc->type);
+ return SQL_ERROR;
+ }
+
+ free(hdbc);
+
+ return SQL_SUCCESS;
}
/*************************************************************************
--
2.43.0

View File

@ -1,72 +0,0 @@
From cb3c9bd4e9eae60f11dc97f3a1fd2cd76e430ed7 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Fri, 3 Feb 2023 14:46:44 +1100
Subject: [PATCH] odbc32: SQLGetInfo/W support InfoType SQL_ODBC_VER
---
dlls/odbc32/proxyodbc.c | 36 ++++++++++++++++++++++++++++++------
1 file changed, 30 insertions(+), 6 deletions(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
index 8cc89f2c7ba..7d654f1131b 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -658,12 +658,24 @@ SQLRETURN WINAPI SQLGetFunctions(SQLHDBC ConnectionHandle, SQLUSMALLINT Function
SQLRETURN WINAPI SQLGetInfo(SQLHDBC ConnectionHandle, SQLUSMALLINT InfoType, SQLPOINTER InfoValue,
SQLSMALLINT BufferLength, SQLSMALLINT *StringLength)
{
- SQLRETURN ret = SQL_ERROR;
+ char *ptr = InfoValue;
- FIXME("(ConnectionHandle, %p, InfoType %d, InfoValue %p, BufferLength %d, StringLength %p)\n", ConnectionHandle,
+ TRACE("(ConnectionHandle, %p, InfoType %d, InfoValue %p, BufferLength %d, StringLength %p)\n", ConnectionHandle,
InfoType, InfoValue, BufferLength, StringLength);
- return ret;
+ switch(InfoType)
+ {
+ case SQL_ODBC_VER:
+ lstrcpynA(ptr, "03.80.0000", BufferLength);
+ if (StringLength)
+ *StringLength = strlen(ptr);
+ break;
+ default:
+ FIXME("Unsupported type %d\n", InfoType);
+ return SQL_ERROR;
+ }
+
+ return SQL_SUCCESS;
}
/*************************************************************************
@@ -1597,12 +1609,24 @@ SQLRETURN WINAPI SQLGetConnectOptionW(SQLHDBC ConnectionHandle, SQLUSMALLINT Opt
SQLRETURN WINAPI SQLGetInfoW(SQLHDBC ConnectionHandle, SQLUSMALLINT InfoType, SQLPOINTER InfoValue,
SQLSMALLINT BufferLength, SQLSMALLINT *StringLength)
{
- SQLRETURN ret = SQL_ERROR;
+ WCHAR *ptr = InfoValue;
- FIXME("(ConnectionHandle, %p, InfoType %d, InfoValue %p, BufferLength %d, StringLength %p)\n", ConnectionHandle,
+ TRACE("(ConnectionHandle, %p, InfoType %d, InfoValue %p, BufferLength %d, StringLength %p)\n", ConnectionHandle,
InfoType, InfoValue, BufferLength, StringLength);
- return ret;
+ switch(InfoType)
+ {
+ case SQL_ODBC_VER:
+ lstrcpynW(ptr, L"03.80.0000", BufferLength);
+ if (StringLength)
+ *StringLength = wcslen(ptr);
+ break;
+ default:
+ FIXME("Unsupported type %d\n", InfoType);
+ return SQL_ERROR;
+ }
+
+ return SQL_SUCCESS;
}
/*************************************************************************
--
2.43.0

View File

@ -1,68 +0,0 @@
From 7f9ebc7aec32bd0a6a53c94dbf96b39fe4cdd2ce Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Fri, 3 Feb 2023 15:18:21 +1100
Subject: [PATCH] odbc32: Support SQL_ATTR_LOGIN_TIMEOUT in SQLSetConnectAttrW
---
dlls/odbc32/proxyodbc.c | 28 +++++++++++++++++++++++++---
1 file changed, 25 insertions(+), 3 deletions(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
index 7d654f1131b..070f0197742 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -53,6 +53,8 @@ struct SQLHDBC_data
{
int type;
struct SQLHENV_data *environment;
+
+ SQLUINTEGER login_timeout;
};
/*************************************************************************
@@ -74,6 +76,7 @@ SQLRETURN WINAPI SQLAllocConnect(SQLHENV EnvironmentHandle, SQLHDBC *ConnectionH
hdbc->type = SQL_HANDLE_DBC;
hdbc->environment = EnvironmentHandle;
+ hdbc->login_timeout = 0;
*ConnectionHandle = hdbc;
@@ -1548,12 +1551,31 @@ SQLRETURN WINAPI SQLGetStmtAttrW(SQLHSTMT StatementHandle, SQLINTEGER Attribute,
SQLRETURN WINAPI SQLSetConnectAttrW(SQLHDBC ConnectionHandle, SQLINTEGER Attribute, SQLPOINTER Value,
SQLINTEGER StringLength)
{
- SQLRETURN ret = SQL_ERROR;
+ struct SQLHDBC_data *hdbc = ConnectionHandle;
- FIXME("(ConnectionHandle %p, Attribute %d, Value %p, StringLength %d)\n", ConnectionHandle, Attribute, Value,
+ TRACE("(ConnectionHandle %p, Attribute %d, Value %p, StringLength %d)\n", ConnectionHandle, Attribute, Value,
StringLength);
- return ret;
+ if (hdbc->type != SQL_HANDLE_DBC)
+ {
+ WARN("Wrong handle type %d\n", hdbc->type);
+ return SQL_ERROR;
+ }
+
+ switch(Attribute)
+ {
+ case SQL_ATTR_LOGIN_TIMEOUT:
+ if (Value)
+ hdbc->login_timeout = (intptr_t)Value;
+ else
+ hdbc->login_timeout = 0;
+ break;
+ default:
+ FIXME("Unhandle attribute %d\n", Attribute);
+ return SQL_ERROR;
+ }
+
+ return SQL_SUCCESS;
}
/*************************************************************************
--
2.43.0

View File

@ -1,427 +0,0 @@
From 63629981578a8ed97d1498b8c2e69484f3d85828 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 | 367 +++++++++++++++++++++++++++++++++++++++-
1 file changed, 365 insertions(+), 2 deletions(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
index 070f0197742..30baf1866a4 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -53,10 +53,248 @@ struct SQLHDBC_data
{
int type;
struct SQLHENV_data *environment;
+ HMODULE module;
+ SQLHENV driver_env;
+ SQLINTEGER driver_ver; /* ODBC version supported by driver */
+ SQLHDBC driver_hdbc;
+
+ SQLRETURN (WINAPI *pSQLAllocConnect)(SQLHENV,SQLHDBC*);
+ SQLRETURN (WINAPI *pSQLAllocEnv)(SQLHENV*);
+ SQLRETURN (WINAPI *pSQLAllocHandle)(SQLSMALLINT,SQLHANDLE,SQLHANDLE*);
+ SQLRETURN (WINAPI *pSQLAllocHandleStd)(SQLSMALLINT,SQLHANDLE,SQLHANDLE*);
+ SQLRETURN (WINAPI *pSQLAllocStmt)(SQLHDBC,SQLHSTMT*);
+ SQLRETURN (WINAPI *pSQLBindCol)(SQLHSTMT,SQLUSMALLINT,SQLSMALLINT,SQLPOINTER,SQLLEN,SQLLEN*);
+ SQLRETURN (WINAPI *pSQLBindParam)(SQLHSTMT,SQLUSMALLINT,SQLSMALLINT,SQLSMALLINT,SQLULEN,SQLSMALLINT,SQLPOINTER,SQLLEN*);
+ SQLRETURN (WINAPI *pSQLBindParameter)(SQLHSTMT,SQLUSMALLINT,SQLSMALLINT,SQLSMALLINT,SQLSMALLINT,SQLULEN,SQLSMALLINT,SQLPOINTER,SQLLEN,SQLLEN*);
+ SQLRETURN (WINAPI *pSQLBrowseConnect)(SQLHDBC,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT,SQLSMALLINT*);
+ SQLRETURN (WINAPI *pSQLBrowseConnectW)(SQLHDBC,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLSMALLINT*);
+ SQLRETURN (WINAPI *pSQLBulkOperations)(SQLHSTMT,SQLSMALLINT);
+ SQLRETURN (WINAPI *pSQLCancel)(SQLHSTMT);
+ SQLRETURN (WINAPI *pSQLCloseCursor)(SQLHSTMT);
+ SQLRETURN (WINAPI *pSQLColAttribute)(SQLHSTMT,SQLUSMALLINT,SQLUSMALLINT,SQLPOINTER,SQLSMALLINT,SQLSMALLINT*,SQLLEN*);
+ SQLRETURN (WINAPI *pSQLColAttributeW)(SQLHSTMT,SQLUSMALLINT,SQLUSMALLINT,SQLPOINTER,SQLSMALLINT,SQLSMALLINT*,SQLLEN*);
+ SQLRETURN (WINAPI *pSQLColAttributes)(SQLHSTMT,SQLUSMALLINT,SQLUSMALLINT,SQLPOINTER,SQLSMALLINT,SQLSMALLINT*,SQLLEN*);
+ SQLRETURN (WINAPI *pSQLColAttributesW)(SQLHSTMT,SQLUSMALLINT,SQLUSMALLINT,SQLPOINTER,SQLSMALLINT,SQLSMALLINT*,SQLLEN*);
+ SQLRETURN (WINAPI *pSQLColumnPrivileges)(SQLHSTMT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT);
+ SQLRETURN (WINAPI *pSQLColumnPrivilegesW)(SQLHSTMT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT);
+ SQLRETURN (WINAPI *pSQLColumns)(SQLHSTMT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT);
+ SQLRETURN (WINAPI *pSQLColumnsW)(SQLHSTMT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT);
+ SQLRETURN (WINAPI *pSQLConnect)(SQLHDBC,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT);
+ SQLRETURN (WINAPI *pSQLConnectW)(SQLHDBC,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT);
+ SQLRETURN (WINAPI *pSQLCopyDesc)(SQLHDESC,SQLHDESC);
+ SQLRETURN (WINAPI *pSQLDescribeCol)(SQLHSTMT,SQLUSMALLINT,SQLCHAR*,SQLSMALLINT,SQLSMALLINT*,SQLSMALLINT*,SQLULEN*,SQLSMALLINT*,SQLSMALLINT*);
+ SQLRETURN (WINAPI *pSQLDescribeColW)(SQLHSTMT,SQLUSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLSMALLINT*,SQLSMALLINT*,SQLULEN*,SQLSMALLINT*,SQLSMALLINT*);
+ SQLRETURN (WINAPI *pSQLDescribeParam)(SQLHSTMT,SQLUSMALLINT,SQLSMALLINT*,SQLULEN*,SQLSMALLINT*,SQLSMALLINT*);
+ SQLRETURN (WINAPI *pSQLDisconnect)(SQLHDBC);
+ SQLRETURN (WINAPI *pSQLDriverConnect)(SQLHDBC,SQLHWND,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT,SQLSMALLINT*,SQLUSMALLINT);
+ SQLRETURN (WINAPI *pSQLDriverConnectW)(SQLHDBC,SQLHWND,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLSMALLINT*,SQLUSMALLINT);
+ SQLRETURN (WINAPI *pSQLEndTran)(SQLSMALLINT,SQLHANDLE,SQLSMALLINT);
+ SQLRETURN (WINAPI *pSQLError)(SQLHENV,SQLHDBC,SQLHSTMT,SQLCHAR*,SQLINTEGER*,SQLCHAR*,SQLSMALLINT,SQLSMALLINT*);
+ SQLRETURN (WINAPI *pSQLErrorW)(SQLHENV,SQLHDBC,SQLHSTMT,SQLWCHAR*,SQLINTEGER*,SQLWCHAR*,SQLSMALLINT,SQLSMALLINT*);
+ SQLRETURN (WINAPI *pSQLExecDirect)(SQLHSTMT,SQLCHAR*,SQLINTEGER);
+ SQLRETURN (WINAPI *pSQLExecDirectW)(SQLHSTMT,SQLWCHAR*,SQLINTEGER);
+ SQLRETURN (WINAPI *pSQLExecute)(SQLHSTMT);
+ SQLRETURN (WINAPI *pSQLExtendedFetch)(SQLHSTMT,SQLUSMALLINT,SQLLEN,SQLULEN*,SQLUSMALLINT*);
+ SQLRETURN (WINAPI *pSQLFetch)(SQLHSTMT);
+ SQLRETURN (WINAPI *pSQLFetchScroll)(SQLHSTMT,SQLSMALLINT,SQLLEN);
+ SQLRETURN (WINAPI *pSQLForeignKeys)(SQLHSTMT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT);
+ SQLRETURN (WINAPI *pSQLForeignKeysW)(SQLHSTMT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT);
+ SQLRETURN (WINAPI *pSQLFreeConnect)(SQLHDBC);
+ SQLRETURN (WINAPI *pSQLFreeEnv)(SQLHENV);
+ SQLRETURN (WINAPI *pSQLFreeHandle)(SQLSMALLINT,SQLHANDLE);
+ SQLRETURN (WINAPI *pSQLFreeStmt)(SQLHSTMT,SQLUSMALLINT);
+ SQLRETURN (WINAPI *pSQLGetConnectAttr)(SQLHDBC,SQLINTEGER,SQLPOINTER,SQLINTEGER,SQLINTEGER*);
+ SQLRETURN (WINAPI *pSQLGetConnectAttrW)(SQLHDBC,SQLINTEGER,SQLPOINTER,SQLINTEGER,SQLINTEGER*);
+ SQLRETURN (WINAPI *pSQLGetConnectOption)(SQLHDBC,SQLUSMALLINT,SQLPOINTER);
+ SQLRETURN (WINAPI *pSQLGetConnectOptionW)(SQLHDBC,SQLUSMALLINT,SQLPOINTER);
+ SQLRETURN (WINAPI *pSQLGetCursorName)(SQLHSTMT,SQLCHAR*,SQLSMALLINT,SQLSMALLINT*);
+ SQLRETURN (WINAPI *pSQLGetCursorNameW)(SQLHSTMT,SQLWCHAR*,SQLSMALLINT,SQLSMALLINT*);
+ SQLRETURN (WINAPI *pSQLGetData)(SQLHSTMT,SQLUSMALLINT,SQLSMALLINT,SQLPOINTER,SQLLEN,SQLLEN*);
+ SQLRETURN (WINAPI *pSQLGetDescField)(SQLHDESC,SQLSMALLINT,SQLSMALLINT,SQLPOINTER,SQLINTEGER,SQLINTEGER*);
+ SQLRETURN (WINAPI *pSQLGetDescFieldW)(SQLHDESC,SQLSMALLINT,SQLSMALLINT,SQLPOINTER,SQLINTEGER,SQLINTEGER*);
+ SQLRETURN (WINAPI *pSQLGetDescRec)(SQLHDESC,SQLSMALLINT,SQLCHAR*,SQLSMALLINT,SQLSMALLINT*,SQLSMALLINT*,SQLSMALLINT*,SQLLEN*,SQLSMALLINT*,SQLSMALLINT*,SQLSMALLINT*);
+ SQLRETURN (WINAPI *pSQLGetDescRecW)(SQLHDESC,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLSMALLINT*,SQLSMALLINT*,SQLSMALLINT*,SQLLEN*,SQLSMALLINT*,SQLSMALLINT*,SQLSMALLINT*);
+ SQLRETURN (WINAPI *pSQLGetDiagField)(SQLSMALLINT,SQLHANDLE,SQLSMALLINT,SQLSMALLINT,SQLPOINTER,SQLSMALLINT,SQLSMALLINT*);
+ SQLRETURN (WINAPI *pSQLGetDiagFieldW)(SQLSMALLINT,SQLHANDLE,SQLSMALLINT,SQLSMALLINT,SQLPOINTER,SQLSMALLINT,SQLSMALLINT*);
+ SQLRETURN (WINAPI *pSQLGetDiagRec)(SQLSMALLINT,SQLHANDLE,SQLSMALLINT,SQLCHAR*,SQLINTEGER*,SQLCHAR*,SQLSMALLINT,SQLSMALLINT*);
+ SQLRETURN (WINAPI *pSQLGetDiagRecA)(SQLSMALLINT,SQLHANDLE,SQLSMALLINT,SQLCHAR*,SQLINTEGER*, SQLCHAR*,SQLSMALLINT,SQLSMALLINT*);
+ SQLRETURN (WINAPI *pSQLGetDiagRecW)(SQLSMALLINT,SQLHANDLE,SQLSMALLINT,SQLWCHAR*,SQLINTEGER*,SQLWCHAR*,SQLSMALLINT,SQLSMALLINT*);
+ SQLRETURN (WINAPI *pSQLGetEnvAttr)(SQLHENV,SQLINTEGER,SQLPOINTER,SQLINTEGER,SQLINTEGER*);
+ SQLRETURN (WINAPI *pSQLGetFunctions)(SQLHDBC,SQLUSMALLINT,SQLUSMALLINT*);
+ SQLRETURN (WINAPI *pSQLGetInfo)(SQLHDBC,SQLUSMALLINT,SQLPOINTER,SQLSMALLINT,SQLSMALLINT*);
+ SQLRETURN (WINAPI *pSQLGetInfoW)(SQLHDBC,SQLUSMALLINT,SQLPOINTER,SQLSMALLINT,SQLSMALLINT*);
+ SQLRETURN (WINAPI *pSQLGetStmtAttr)(SQLHSTMT,SQLINTEGER,SQLPOINTER,SQLINTEGER,SQLINTEGER*);
+ SQLRETURN (WINAPI *pSQLGetStmtAttrW)(SQLHSTMT,SQLINTEGER,SQLPOINTER,SQLINTEGER,SQLINTEGER*);
+ SQLRETURN (WINAPI *pSQLGetStmtOption)(SQLHSTMT,SQLUSMALLINT,SQLPOINTER);
+ SQLRETURN (WINAPI *pSQLGetTypeInfo)(SQLHSTMT,SQLSMALLINT);
+ SQLRETURN (WINAPI *pSQLGetTypeInfoW)(SQLHSTMT,SQLSMALLINT);
+ SQLRETURN (WINAPI *pSQLMoreResults)(SQLHSTMT);
+ SQLRETURN (WINAPI *pSQLNativeSql)(SQLHDBC,SQLCHAR*,SQLINTEGER,SQLCHAR*,SQLINTEGER,SQLINTEGER*);
+ SQLRETURN (WINAPI *pSQLNativeSqlW)(SQLHDBC,SQLWCHAR*,SQLINTEGER,SQLWCHAR*,SQLINTEGER,SQLINTEGER*);
+ SQLRETURN (WINAPI *pSQLNumParams)(SQLHSTMT,SQLSMALLINT*);
+ SQLRETURN (WINAPI *pSQLNumResultCols)(SQLHSTMT,SQLSMALLINT*);
+ SQLRETURN (WINAPI *pSQLParamData)(SQLHSTMT,SQLPOINTER*);
+ SQLRETURN (WINAPI *pSQLParamOptions)(SQLHSTMT,SQLULEN,SQLULEN*);
+ SQLRETURN (WINAPI *pSQLPrepare)(SQLHSTMT,SQLCHAR*,SQLINTEGER);
+ SQLRETURN (WINAPI *pSQLPrepareW)(SQLHSTMT,SQLWCHAR*,SQLINTEGER);
+ SQLRETURN (WINAPI *pSQLPrimaryKeys)(SQLHSTMT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT);
+ SQLRETURN (WINAPI *pSQLPrimaryKeysW)(SQLHSTMT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT);
+ SQLRETURN (WINAPI *pSQLProcedureColumns)(SQLHSTMT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT);
+ SQLRETURN (WINAPI *pSQLProcedureColumnsW)(SQLHSTMT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT);
+ SQLRETURN (WINAPI *pSQLProcedures)(SQLHSTMT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT);
+ SQLRETURN (WINAPI *pSQLProceduresW)(SQLHSTMT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT);
+ SQLRETURN (WINAPI *pSQLPutData)(SQLHSTMT,SQLPOINTER,SQLLEN);
+ SQLRETURN (WINAPI *pSQLRowCount)(SQLHSTMT,SQLLEN*);
+ SQLRETURN (WINAPI *pSQLSetConnectAttr)(SQLHDBC,SQLINTEGER,SQLPOINTER,SQLINTEGER);
+ SQLRETURN (WINAPI *pSQLSetConnectAttrW)(SQLHDBC,SQLINTEGER,SQLPOINTER,SQLINTEGER);
+ SQLRETURN (WINAPI *pSQLSetConnectOption)(SQLHDBC,SQLUSMALLINT,SQLULEN);
+ SQLRETURN (WINAPI *pSQLSetConnectOptionW)(SQLHDBC,SQLUSMALLINT,SQLULEN);
+ SQLRETURN (WINAPI *pSQLSetCursorName)(SQLHSTMT,SQLCHAR*,SQLSMALLINT);
+ SQLRETURN (WINAPI *pSQLSetCursorNameW)(SQLHSTMT,SQLWCHAR*,SQLSMALLINT);
+ SQLRETURN (WINAPI *pSQLSetDescField)(SQLHDESC,SQLSMALLINT,SQLSMALLINT,SQLPOINTER,SQLINTEGER);
+ SQLRETURN (WINAPI *pSQLSetDescFieldW)(SQLHDESC,SQLSMALLINT,SQLSMALLINT,SQLPOINTER,SQLINTEGER);
+ SQLRETURN (WINAPI *pSQLSetDescRec)(SQLHDESC,SQLSMALLINT,SQLSMALLINT,SQLSMALLINT,SQLLEN,SQLSMALLINT,SQLSMALLINT,SQLPOINTER,SQLLEN*,SQLLEN*);
+ SQLRETURN (WINAPI *pSQLSetEnvAttr)(SQLHENV,SQLINTEGER,SQLPOINTER,SQLINTEGER);
+ SQLRETURN (WINAPI *pSQLSetParam)(SQLHSTMT,SQLUSMALLINT,SQLSMALLINT,SQLSMALLINT,SQLULEN,SQLSMALLINT,SQLPOINTER,SQLLEN*);
+ SQLRETURN (WINAPI *pSQLSetPos)(SQLHSTMT,SQLSETPOSIROW,SQLUSMALLINT,SQLUSMALLINT);
+ SQLRETURN (WINAPI *pSQLSetScrollOptions)(SQLHSTMT,SQLUSMALLINT,SQLLEN,SQLUSMALLINT);
+ SQLRETURN (WINAPI *pSQLSetStmtAttr)(SQLHSTMT,SQLINTEGER,SQLPOINTER,SQLINTEGER);
+ SQLRETURN (WINAPI *pSQLSetStmtAttrW)(SQLHSTMT,SQLINTEGER,SQLPOINTER,SQLINTEGER);
+ SQLRETURN (WINAPI *pSQLSetStmtOption)(SQLHSTMT,SQLUSMALLINT,SQLULEN);
+ SQLRETURN (WINAPI *pSQLSpecialColumns)(SQLHSTMT,SQLUSMALLINT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT,SQLUSMALLINT,SQLUSMALLINT);
+ SQLRETURN (WINAPI *pSQLSpecialColumnsW)(SQLHSTMT,SQLUSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLUSMALLINT,SQLUSMALLINT);
+ SQLRETURN (WINAPI *pSQLStatistics)(SQLHSTMT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT,SQLUSMALLINT,SQLUSMALLINT);
+ SQLRETURN (WINAPI *pSQLStatisticsW)(SQLHSTMT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLUSMALLINT,SQLUSMALLINT);
+ SQLRETURN (WINAPI *pSQLTablePrivileges)(SQLHSTMT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT);
+ SQLRETURN (WINAPI *pSQLTablePrivilegesW)(SQLHSTMT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT);
+ SQLRETURN (WINAPI *pSQLTables)(SQLHSTMT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT);
+ SQLRETURN (WINAPI *pSQLTablesW)(SQLHSTMT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT);
+ SQLRETURN (WINAPI *pSQLTransact)(SQLHENV,SQLHDBC,SQLUSMALLINT);
SQLUINTEGER login_timeout;
};
+static void connection_bind_sql_funcs(struct SQLHDBC_data *connection)
+{
+#define LOAD_FUNCPTR(f) if((connection->p##f = (void*)GetProcAddress(connection->module, #f)) == NULL) \
+ { \
+ WARN( "function '%s' not found in driver.\n", #f ); \
+ }
+
+ LOAD_FUNCPTR(SQLAllocConnect);
+ LOAD_FUNCPTR(SQLAllocEnv);
+ LOAD_FUNCPTR(SQLAllocHandle);
+ LOAD_FUNCPTR(SQLAllocHandleStd)
+ LOAD_FUNCPTR(SQLAllocStmt);
+ LOAD_FUNCPTR(SQLBindCol);
+ LOAD_FUNCPTR(SQLBindParam);
+ LOAD_FUNCPTR(SQLBindParameter);
+ LOAD_FUNCPTR(SQLBrowseConnect);
+ LOAD_FUNCPTR(SQLBrowseConnectW);
+ LOAD_FUNCPTR(SQLBulkOperations);
+ LOAD_FUNCPTR(SQLCancel);
+ LOAD_FUNCPTR(SQLCloseCursor);
+ LOAD_FUNCPTR(SQLColAttribute);
+ LOAD_FUNCPTR(SQLColAttributeW);
+ LOAD_FUNCPTR(SQLColAttributes);
+ LOAD_FUNCPTR(SQLColAttributesW);
+ LOAD_FUNCPTR(SQLColumnPrivileges);
+ LOAD_FUNCPTR(SQLColumnPrivilegesW)
+ LOAD_FUNCPTR(SQLColumns);
+ LOAD_FUNCPTR(SQLColumnsW);
+ LOAD_FUNCPTR(SQLConnect);
+ LOAD_FUNCPTR(SQLConnectW);
+ LOAD_FUNCPTR(SQLCopyDesc);
+ LOAD_FUNCPTR(SQLDescribeCol);
+ LOAD_FUNCPTR(SQLDescribeColW);
+ LOAD_FUNCPTR(SQLDescribeParam);
+ LOAD_FUNCPTR(SQLDisconnect);
+ LOAD_FUNCPTR(SQLDriverConnect);
+ LOAD_FUNCPTR(SQLDriverConnectW);
+ LOAD_FUNCPTR(SQLEndTran);
+ LOAD_FUNCPTR(SQLError);
+ LOAD_FUNCPTR(SQLErrorW);
+ LOAD_FUNCPTR(SQLExecDirect);
+ LOAD_FUNCPTR(SQLExecDirectW);
+ LOAD_FUNCPTR(SQLExecute);
+ LOAD_FUNCPTR(SQLExtendedFetch);
+ LOAD_FUNCPTR(SQLFetch);
+ LOAD_FUNCPTR(SQLFetchScroll);
+ LOAD_FUNCPTR(SQLForeignKeys);
+ LOAD_FUNCPTR(SQLForeignKeysW);
+ LOAD_FUNCPTR(SQLFreeConnect);
+ LOAD_FUNCPTR(SQLFreeEnv);
+ LOAD_FUNCPTR(SQLFreeHandle);
+ LOAD_FUNCPTR(SQLFreeStmt);
+ LOAD_FUNCPTR(SQLGetConnectAttr);
+ LOAD_FUNCPTR(SQLGetConnectAttrW);
+ LOAD_FUNCPTR(SQLGetConnectOption);
+ LOAD_FUNCPTR(SQLGetConnectOptionW);
+ LOAD_FUNCPTR(SQLGetCursorName);
+ LOAD_FUNCPTR(SQLGetCursorNameW);
+ LOAD_FUNCPTR(SQLGetData);
+ LOAD_FUNCPTR(SQLGetDescField);
+ LOAD_FUNCPTR(SQLGetDescFieldW);
+ LOAD_FUNCPTR(SQLGetDescRec);
+ LOAD_FUNCPTR(SQLGetDescRecW);
+ LOAD_FUNCPTR(SQLGetDiagField);
+ LOAD_FUNCPTR(SQLGetDiagFieldW);
+ LOAD_FUNCPTR(SQLGetDiagRec);
+ LOAD_FUNCPTR(SQLGetDiagRecA);
+ LOAD_FUNCPTR(SQLGetDiagRecW);
+ LOAD_FUNCPTR(SQLGetEnvAttr);
+ LOAD_FUNCPTR(SQLGetFunctions);
+ LOAD_FUNCPTR(SQLGetInfo);
+ LOAD_FUNCPTR(SQLGetInfoW);
+ LOAD_FUNCPTR(SQLGetStmtAttr);
+ LOAD_FUNCPTR(SQLGetStmtAttrW);
+ LOAD_FUNCPTR(SQLGetStmtOption);
+ LOAD_FUNCPTR(SQLGetTypeInfo);
+ LOAD_FUNCPTR(SQLGetTypeInfoW);
+ LOAD_FUNCPTR(SQLMoreResults);
+ LOAD_FUNCPTR(SQLNativeSql);
+ LOAD_FUNCPTR(SQLNativeSqlW);
+ LOAD_FUNCPTR(SQLNumParams);
+ LOAD_FUNCPTR(SQLNumResultCols);
+ LOAD_FUNCPTR(SQLParamData);
+ LOAD_FUNCPTR(SQLParamOptions);
+ LOAD_FUNCPTR(SQLPrepare);
+ LOAD_FUNCPTR(SQLPrepareW);
+ LOAD_FUNCPTR(SQLPrimaryKeys);
+ LOAD_FUNCPTR(SQLPrimaryKeysW);
+ LOAD_FUNCPTR(SQLProcedureColumns);
+ LOAD_FUNCPTR(SQLProcedureColumnsW);
+ LOAD_FUNCPTR(SQLProcedures);
+ LOAD_FUNCPTR(SQLProceduresW);
+ LOAD_FUNCPTR(SQLPutData);
+ LOAD_FUNCPTR(SQLRowCount);
+ LOAD_FUNCPTR(SQLSetConnectAttr);
+ LOAD_FUNCPTR(SQLSetConnectAttrW);
+ LOAD_FUNCPTR(SQLSetConnectOption);
+ LOAD_FUNCPTR(SQLSetConnectOptionW);
+ LOAD_FUNCPTR(SQLSetCursorName);
+ LOAD_FUNCPTR(SQLSetCursorNameW);
+ LOAD_FUNCPTR(SQLSetDescField);
+ LOAD_FUNCPTR(SQLSetDescFieldW);
+ LOAD_FUNCPTR(SQLSetDescRec);
+ LOAD_FUNCPTR(SQLSetEnvAttr);
+ LOAD_FUNCPTR(SQLSetParam);
+ LOAD_FUNCPTR(SQLSetPos);
+ LOAD_FUNCPTR(SQLSetScrollOptions);
+ LOAD_FUNCPTR(SQLSetStmtAttr);
+ LOAD_FUNCPTR(SQLSetStmtAttrW);
+ LOAD_FUNCPTR(SQLSetStmtOption);
+ LOAD_FUNCPTR(SQLSpecialColumns);
+ LOAD_FUNCPTR(SQLSpecialColumnsW);
+ LOAD_FUNCPTR(SQLStatistics);
+ LOAD_FUNCPTR(SQLStatisticsW);
+ LOAD_FUNCPTR(SQLTablePrivileges);
+ LOAD_FUNCPTR(SQLTablePrivilegesW);
+ LOAD_FUNCPTR(SQLTables);
+ LOAD_FUNCPTR(SQLTablesW);
+ LOAD_FUNCPTR(SQLTransact);
+}
+
/*************************************************************************
* SQLAllocConnect [ODBC32.001]
*/
@@ -77,6 +315,7 @@ SQLRETURN WINAPI SQLAllocConnect(SQLHENV EnvironmentHandle, SQLHDBC *ConnectionH
hdbc->type = SQL_HANDLE_DBC;
hdbc->environment = EnvironmentHandle;
hdbc->login_timeout = 0;
+ hdbc->module = NULL;
*ConnectionHandle = hdbc;
@@ -438,6 +677,8 @@ SQLRETURN WINAPI SQLFreeConnect(SQLHDBC ConnectionHandle)
return SQL_ERROR;
}
+ FreeLibrary(hdbc->module);
+
free(hdbc);
return SQL_SUCCESS;
@@ -1596,6 +1837,65 @@ SQLRETURN WINAPI SQLColumnsW(SQLHSTMT StatementHandle, WCHAR *CatalogName, SQLSM
return ret;
}
+static HMODULE load_odbc_driver(const WCHAR *driver, BOOL use_dsn)
+{
+ long ret;
+ HMODULE hmod;
+ WCHAR *filename = NULL;
+ HKEY hkey;
+ WCHAR regpath[256];
+
+ if (use_dsn)
+ wcscpy(regpath, L"Software\\ODBC\\ODBC.INI\\");
+ else
+ wcscpy(regpath, L"Software\\ODBC\\ODBCINST.INI\\");
+ wcscat(regpath, driver);
+
+ if ((ret = RegOpenKeyW(HKEY_CURRENT_USER, regpath, &hkey)) != ERROR_SUCCESS)
+ {
+ ret = RegOpenKeyW(HKEY_LOCAL_MACHINE, regpath, &hkey);
+ }
+
+ if (ret == ERROR_SUCCESS)
+ {
+ DWORD size = 0, type;
+ ret = RegGetValueW(hkey, NULL, L"Driver", RRF_RT_REG_SZ, &type, NULL, &size);
+ if(ret != ERROR_SUCCESS || type != REG_SZ)
+ {
+ RegCloseKey(hkey);
+ WARN("Invalid DSN %s\n", debugstr_w(driver));
+
+ return NULL;
+ }
+
+ filename = malloc(size);
+ if(!filename)
+ {
+ RegCloseKey(hkey);
+ ERR("Out of memory\n");
+
+ return NULL;
+ }
+ ret = RegGetValueW(hkey, NULL, L"Driver", RRF_RT_REG_SZ, &type, filename, &size);
+
+ RegCloseKey(hkey);
+ }
+
+ if(ret != ERROR_SUCCESS)
+ {
+ free(filename);
+ ERR("Failed to open Registry Key\n");
+ return NULL;
+ }
+
+ hmod = LoadLibraryExW(filename, NULL, LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR | LOAD_LIBRARY_SEARCH_DEFAULT_DIRS);
+ free(filename);
+
+ if(!hmod)
+ ERR("Failed to load driver\n");
+
+ return hmod;
+}
/*************************************************************************
* SQLDriverConnectW [ODBC32.141]
*/
@@ -1603,13 +1903,76 @@ SQLRETURN WINAPI SQLDriverConnectW(SQLHDBC ConnectionHandle, SQLHWND WindowHandl
SQLSMALLINT Length, WCHAR *OutConnectionString, SQLSMALLINT BufferLength,
SQLSMALLINT *Length2, SQLUSMALLINT DriverCompletion)
{
+ struct SQLHDBC_data *connection = ConnectionHandle;
+ HMODULE driver;
SQLRETURN ret = SQL_ERROR;
+ WCHAR dsn[128];
+ WCHAR *p;
+ BOOL is_dsn = TRUE;
- FIXME("(ConnectionHandle %p, WindowHandle %p, InConnectionString %s, Length %d, OutConnectionString %p,"
+ TRACE("(ConnectionHandle %p, WindowHandle %p, InConnectionString %s, Length %d, OutConnectionString %p,"
" BufferLength %d, Length2 %p, DriverCompletion %d)\n", ConnectionHandle, WindowHandle,
- debugstr_wn(InConnectionString, Length), Length, OutConnectionString, BufferLength, Length2,
+ Length == SQL_NTS ? debugstr_w(InConnectionString) : debugstr_wn(InConnectionString, Length), Length, OutConnectionString, BufferLength, Length2,
DriverCompletion);
+ p = wcsstr(InConnectionString, L"DSN=");
+ if (p)
+ {
+ WCHAR *end = wcsstr(p, L";");
+
+ lstrcpynW(dsn, p+4, end - (p + 3));
+ }
+ else
+ {
+ p = wcsstr(InConnectionString, L"Driver=");
+ if (p)
+ {
+ WCHAR *end = wcsstr(p, L";");
+
+ lstrcpynW(dsn, p+7, end - (p + 6));
+ is_dsn = FALSE;
+ }
+ }
+
+ driver = load_odbc_driver(dsn, is_dsn);
+ if (!driver)
+ 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);
+
+ connection->pSQLAllocConnect(connection->driver_env, &connection->driver_hdbc);
+ }
+ else
+ ERR("No functions to allocated Environment handles found.\n");
+
+ if(!connection->pSQLDriverConnectW)
+ {
+ ERR("Failed to find pSQLDriverConnectW\n");
+ return SQL_ERROR;
+ }
+
+ ret = connection->pSQLDriverConnectW(connection->driver_hdbc, WindowHandle, InConnectionString, Length,
+ OutConnectionString, BufferLength, Length2, DriverCompletion);
+
+ TRACE("Driver returned %d\n", ret);
+
return ret;
}
--
2.43.0

View File

@ -1,82 +0,0 @@
From 55674ad31123cfdcf664d8f1c28710185aa0388d Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Mon, 6 Feb 2023 08:47:46 +1100
Subject: [PATCH] odbc32: Foward SQLGetInfo/W requests onto the driver
---
dlls/odbc32/proxyodbc.c | 32 ++++++++++++++++++++++++++------
1 file changed, 26 insertions(+), 6 deletions(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
index 30baf1866a4..50083a23e25 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -902,7 +902,9 @@ SQLRETURN WINAPI SQLGetFunctions(SQLHDBC ConnectionHandle, SQLUSMALLINT Function
SQLRETURN WINAPI SQLGetInfo(SQLHDBC ConnectionHandle, SQLUSMALLINT InfoType, SQLPOINTER InfoValue,
SQLSMALLINT BufferLength, SQLSMALLINT *StringLength)
{
+ struct SQLHDBC_data *connection = ConnectionHandle;
char *ptr = InfoValue;
+ SQLRETURN ret = SQL_SUCCESS;
TRACE("(ConnectionHandle, %p, InfoType %d, InfoValue %p, BufferLength %d, StringLength %p)\n", ConnectionHandle,
InfoType, InfoValue, BufferLength, StringLength);
@@ -915,11 +917,19 @@ SQLRETURN WINAPI SQLGetInfo(SQLHDBC ConnectionHandle, SQLUSMALLINT InfoType, SQL
*StringLength = strlen(ptr);
break;
default:
- FIXME("Unsupported type %d\n", InfoType);
- return SQL_ERROR;
+ if (connection->pSQLGetInfo)
+ ret = connection->pSQLGetInfo(connection->driver_hdbc, InfoType, InfoValue,
+ BufferLength, StringLength);
+ else
+ {
+ FIXME("Unsupported type %d\n", InfoType);
+ ret = SQL_ERROR;
+ }
}
- return SQL_SUCCESS;
+ TRACE("ret %d\n", ret);
+
+ return ret;
}
/*************************************************************************
@@ -1994,7 +2004,9 @@ SQLRETURN WINAPI SQLGetConnectOptionW(SQLHDBC ConnectionHandle, SQLUSMALLINT Opt
SQLRETURN WINAPI SQLGetInfoW(SQLHDBC ConnectionHandle, SQLUSMALLINT InfoType, SQLPOINTER InfoValue,
SQLSMALLINT BufferLength, SQLSMALLINT *StringLength)
{
+ struct SQLHDBC_data *connection = ConnectionHandle;
WCHAR *ptr = InfoValue;
+ SQLRETURN ret = SQL_SUCCESS;
TRACE("(ConnectionHandle, %p, InfoType %d, InfoValue %p, BufferLength %d, StringLength %p)\n", ConnectionHandle,
InfoType, InfoValue, BufferLength, StringLength);
@@ -2007,11 +2019,19 @@ SQLRETURN WINAPI SQLGetInfoW(SQLHDBC ConnectionHandle, SQLUSMALLINT InfoType, SQ
*StringLength = wcslen(ptr);
break;
default:
- FIXME("Unsupported type %d\n", InfoType);
- return SQL_ERROR;
+ if (connection->pSQLGetInfoW)
+ ret = connection->pSQLGetInfoW(connection->driver_hdbc, InfoType, InfoValue,
+ BufferLength, StringLength);
+ else
+ {
+ FIXME("Unsupported type %d\n", InfoType);
+ ret = SQL_ERROR;
+ }
}
- return SQL_SUCCESS;
+ TRACE("ret %d\n", ret);
+
+ return ret;
}
/*************************************************************************
--
2.43.0

View File

@ -1,91 +0,0 @@
From 7db07cc12c6e62ab86b429d0c0b0f88426ddb681 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Mon, 6 Feb 2023 08:55:12 +1100
Subject: [PATCH] odbc32: Foward SQLSetConnectAttr requets onto the driver
---
dlls/odbc32/proxyodbc.c | 49 ++++++++++++++++++++++++++++++++++++-----
1 file changed, 44 insertions(+), 5 deletions(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
index 50083a23e25..f817b3b524c 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -1043,11 +1043,40 @@ SQLRETURN WINAPI SQLRowCount(SQLHSTMT StatementHandle, SQLLEN *RowCount)
SQLRETURN WINAPI SQLSetConnectAttr(SQLHDBC ConnectionHandle, SQLINTEGER Attribute, SQLPOINTER Value,
SQLINTEGER StringLength)
{
- SQLRETURN ret = SQL_ERROR;
+ struct SQLHDBC_data *hdbc = ConnectionHandle;
+ SQLRETURN ret = SQL_SUCCESS;
- FIXME("(ConnectionHandle %p, Attribute %d, Value %p, StringLength %d)\n", ConnectionHandle, Attribute, Value,
+ TRACE("(ConnectionHandle %p, Attribute %d, Value %p, StringLength %d)\n", ConnectionHandle, Attribute, Value,
StringLength);
+ if (hdbc->type != SQL_HANDLE_DBC)
+ {
+ WARN("Wrong handle type %d\n", hdbc->type);
+ return SQL_ERROR;
+ }
+
+ switch(Attribute)
+ {
+ case SQL_ATTR_LOGIN_TIMEOUT:
+ if (Value)
+ hdbc->login_timeout = (intptr_t)Value;
+ else
+ hdbc->login_timeout = 0;
+ break;
+ default:
+ if (hdbc->pSQLSetConnectAttr)
+ ret = hdbc->pSQLSetConnectAttr(hdbc->driver_hdbc, Attribute, Value, StringLength);
+ else if(hdbc->pSQLSetConnectOption)
+ ret = hdbc->pSQLSetConnectOption(hdbc->driver_hdbc, Attribute, (SQLULEN)Value);
+ else
+ {
+ FIXME("Unsupported Attribute %d\n", Attribute);
+ ret = SQL_ERROR;
+ }
+ }
+
+ TRACE("ret %d\n", ret);
+
return ret;
}
@@ -1803,6 +1832,7 @@ SQLRETURN WINAPI SQLSetConnectAttrW(SQLHDBC ConnectionHandle, SQLINTEGER Attribu
SQLINTEGER StringLength)
{
struct SQLHDBC_data *hdbc = ConnectionHandle;
+ SQLRETURN ret = SQL_SUCCESS;
TRACE("(ConnectionHandle %p, Attribute %d, Value %p, StringLength %d)\n", ConnectionHandle, Attribute, Value,
StringLength);
@@ -1822,11 +1852,20 @@ SQLRETURN WINAPI SQLSetConnectAttrW(SQLHDBC ConnectionHandle, SQLINTEGER Attribu
hdbc->login_timeout = 0;
break;
default:
- FIXME("Unhandle attribute %d\n", Attribute);
- return SQL_ERROR;
+ if (hdbc->pSQLSetConnectAttrW)
+ ret = hdbc->pSQLSetConnectAttrW(hdbc->driver_hdbc, Attribute, Value, StringLength);
+ else if(hdbc->pSQLSetConnectOptionW)
+ ret = hdbc->pSQLSetConnectOptionW(hdbc->driver_hdbc, Attribute, (SQLULEN)Value);
+ else
+ {
+ FIXME("Unsupported Attribute %d\n", Attribute);
+ ret = SQL_ERROR;
+ }
}
- return SQL_SUCCESS;
+ TRACE("ret %d\n", ret);
+
+ return ret;
}
/*************************************************************************
--
2.43.0

View File

@ -1,33 +0,0 @@
From 25b167b0027c64be079c7203b994dac1b5627446 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Mon, 6 Feb 2023 09:02:34 +1100
Subject: [PATCH] odbc32: Forward SQLGetFunctions requets onto the driver
---
dlls/odbc32/proxyodbc.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
index f817b3b524c..3ed0a484972 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -889,9 +889,15 @@ SQLRETURN WINAPI SQLGetEnvAttr(SQLHENV EnvironmentHandle, SQLINTEGER Attribute,
*/
SQLRETURN WINAPI SQLGetFunctions(SQLHDBC ConnectionHandle, SQLUSMALLINT FunctionId, SQLUSMALLINT *Supported)
{
+ struct SQLHDBC_data *connection = ConnectionHandle;
SQLRETURN ret = SQL_ERROR;
- FIXME("(ConnectionHandle %p, FunctionId %d, Supported %p)\n", ConnectionHandle, FunctionId, Supported);
+ TRACE("(ConnectionHandle %p, FunctionId %d, Supported %p)\n", ConnectionHandle, FunctionId, Supported);
+
+ if (connection->pSQLGetFunctions)
+ {
+ ret = connection->pSQLGetFunctions(connection->driver_hdbc, FunctionId, Supported);
+ }
return ret;
}
--
2.43.0

View File

@ -1,80 +0,0 @@
From 53e0846f51522be5a2f7574f12ff35d16c44d1de Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Mon, 6 Feb 2023 09:08:27 +1100
Subject: [PATCH] odbc32: Forward SQLGetConnectAttr/W requets onto the driver
---
dlls/odbc32/proxyodbc.c | 42 +++++++++++++++++++++++++++++++++++++++--
1 file changed, 40 insertions(+), 2 deletions(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
index 3ed0a484972..886fe07efb9 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -730,11 +730,30 @@ SQLRETURN WINAPI SQLFreeStmt(SQLHSTMT StatementHandle, SQLUSMALLINT Option)
SQLRETURN WINAPI SQLGetConnectAttr(SQLHDBC ConnectionHandle, SQLINTEGER Attribute, SQLPOINTER Value,
SQLINTEGER BufferLength, SQLINTEGER *StringLength)
{
+ struct SQLHDBC_data *connection = ConnectionHandle;
SQLRETURN ret = SQL_ERROR;
- FIXME("(ConnectionHandle %p, Attribute %d, Value %p, BufferLength %d, StringLength %p)\n", ConnectionHandle,
+ TRACE("(ConnectionHandle %p, Attribute %d, Value %p, BufferLength %d, StringLength %p)\n", ConnectionHandle,
Attribute, Value, BufferLength, StringLength);
+ if (connection->type != SQL_HANDLE_DBC)
+ {
+ WARN("Wrong handle type %d\n", connection->type);
+ return SQL_ERROR;
+ }
+
+ if (connection->pSQLGetConnectAttr)
+ {
+ ret = connection->pSQLGetConnectAttr(connection->driver_hdbc, Attribute, Value,
+ BufferLength, StringLength);
+ }
+ else if (connection->pSQLGetConnectOption)
+ {
+ ret = connection->pSQLGetConnectOption(connection->driver_hdbc, Attribute, Value);
+ }
+
+ TRACE("ret %d\n", ret);
+
return ret;
}
@@ -1741,11 +1760,30 @@ SQLRETURN WINAPI SQLColAttributeW(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnN
SQLRETURN WINAPI SQLGetConnectAttrW(SQLHDBC ConnectionHandle, SQLINTEGER Attribute, SQLPOINTER Value,
SQLINTEGER BufferLength, SQLINTEGER *StringLength)
{
+ struct SQLHDBC_data *connection = ConnectionHandle;
SQLRETURN ret = SQL_ERROR;
- FIXME("(ConnectionHandle %p, Attribute %d, Value %p, BufferLength %d, StringLength %p)\n", ConnectionHandle,
+ TRACE("(ConnectionHandle %p, Attribute %d, Value %p, BufferLength %d, StringLength %p)\n", ConnectionHandle,
Attribute, Value, BufferLength, StringLength);
+ if (connection->type != SQL_HANDLE_DBC)
+ {
+ WARN("Wrong handle type %d\n", connection->type);
+ return SQL_ERROR;
+ }
+
+ if (connection->pSQLGetConnectAttrW)
+ {
+ ret = connection->pSQLGetConnectAttrW(connection->driver_hdbc, Attribute, Value,
+ BufferLength, StringLength);
+ }
+ else if (connection->pSQLGetConnectOptionW)
+ {
+ ret = connection->pSQLGetConnectOptionW(connection->driver_hdbc, Attribute, Value);
+ }
+
+ TRACE("ret %d\n", ret);
+
return ret;
}
--
2.43.0

View File

@ -1,41 +0,0 @@
From fc34342d52977928717c0b9f45bff99613461201 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Mon, 6 Feb 2023 09:26:57 +1100
Subject: [PATCH] odbc32: Foward SQLDisconnect request onto 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 886fe07efb9..eb274c5da5b 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -574,9 +574,23 @@ SQLRETURN WINAPI SQLDescribeCol(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNum
*/
SQLRETURN WINAPI SQLDisconnect(SQLHDBC ConnectionHandle)
{
+ struct SQLHDBC_data *connection = ConnectionHandle;
SQLRETURN ret = SQL_ERROR;
- FIXME("(ConnectionHandle %p)\n", ConnectionHandle);
+ TRACE("(ConnectionHandle %p)\n", ConnectionHandle);
+
+ if (connection->type != SQL_HANDLE_DBC)
+ {
+ WARN("Wrong handle type %d\n", connection->type);
+ return SQL_ERROR;
+ }
+
+ if (connection->pSQLDisconnect)
+ {
+ ret = connection->pSQLDisconnect(connection->driver_hdbc);
+ }
+
+ TRACE("ret %d\n", ret);
return ret;
}
--
2.43.0

View File

@ -1,73 +0,0 @@
From a09926caf2fd91460ab75d75c3aba98a153f97fa Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Mon, 6 Feb 2023 09:53:34 +1100
Subject: [PATCH] odbc32: Implement SQLAllocStmt
---
dlls/odbc32/proxyodbc.c | 39 ++++++++++++++++++++++++++++++++++++++-
1 file changed, 38 insertions(+), 1 deletion(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
index eb274c5da5b..1e6ee80c03d 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -174,6 +174,13 @@ struct SQLHDBC_data
SQLUINTEGER login_timeout;
};
+struct SQLHSTMT_data
+{
+ int type;
+ struct SQLHDBC_data *connection;
+ SQLHSTMT driver_stmt;
+};
+
static void connection_bind_sql_funcs(struct SQLHDBC_data *connection)
{
#define LOAD_FUNCPTR(f) if((connection->p##f = (void*)GetProcAddress(connection->module, #f)) == NULL) \
@@ -365,11 +372,41 @@ SQLRETURN WINAPI SQLAllocHandle(SQLSMALLINT HandleType, SQLHANDLE InputHandle, S
*/
SQLRETURN WINAPI SQLAllocStmt(SQLHDBC ConnectionHandle, SQLHSTMT *StatementHandle)
{
+ struct SQLHDBC_data *connection = ConnectionHandle;
+ struct SQLHSTMT_data *stmt;
SQLRETURN ret = SQL_ERROR;
- FIXME("(ConnectionHandle %p, StatementHandle %p)\n", ConnectionHandle, StatementHandle);
+ TRACE("(ConnectionHandle %p, StatementHandle %p)\n", ConnectionHandle, StatementHandle);
*StatementHandle = SQL_NULL_HSTMT;
+ if (connection->type != SQL_HANDLE_DBC)
+ {
+ WARN("Wrong handle type %d\n", connection->type);
+ return SQL_ERROR;
+ }
+
+ stmt = malloc(sizeof(*stmt));
+ if (!stmt)
+ {
+ return SQL_ERROR;
+ }
+
+ stmt->type = SQL_HANDLE_STMT;
+ stmt->connection = connection;
+
+ /* Default to ODBC v3 function */
+ if(connection->pSQLAllocHandle)
+ {
+ ret = connection->pSQLAllocHandle(SQL_HANDLE_STMT, connection->driver_hdbc, &stmt->driver_stmt);
+ }
+ else if (connection->pSQLAllocStmt)
+ {
+ ret = connection->pSQLAllocStmt(connection->driver_hdbc, &stmt->driver_stmt);
+ }
+
+ *StatementHandle = stmt;
+
+ TRACE("ret %d\n", ret);
return ret;
}
--
2.43.0

View File

@ -1,76 +0,0 @@
From 2f3d8481978439bdc657f5f020e255c9c2c634d1 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] odbc32: Forward SQLSetStmtAttr/W request to driver
---
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 1e6ee80c03d..999d1e64916 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -1266,11 +1266,28 @@ SQLRETURN WINAPI SQLSetParam(SQLHSTMT StatementHandle, SQLUSMALLINT ParameterNum
SQLRETURN WINAPI SQLSetStmtAttr(SQLHSTMT StatementHandle, SQLINTEGER Attribute, SQLPOINTER Value,
SQLINTEGER StringLength)
{
+ struct SQLHSTMT_data *statement = StatementHandle;
SQLRETURN ret = SQL_ERROR;
- FIXME("(StatementHandle %p, Attribute %d, Value %p, StringLength %d)\n", StatementHandle, Attribute, Value,
+ TRACE("(StatementHandle %p, Attribute %d, Value %p, StringLength %d)\n", StatementHandle, Attribute, Value,
StringLength);
+ if (statement->type != SQL_HANDLE_STMT)
+ {
+ WARN("Wrong handle type %d\n", statement->type);
+ return SQL_ERROR;
+ }
+
+ if (statement->connection->pSQLSetStmtAttr)
+ {
+ 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;
}
@@ -2438,11 +2455,28 @@ SQLRETURN WINAPI SQLSetDescFieldW(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumb
SQLRETURN WINAPI SQLSetStmtAttrW(SQLHSTMT StatementHandle, SQLINTEGER Attribute, SQLPOINTER Value,
SQLINTEGER StringLength)
{
+ struct SQLHSTMT_data *statement = StatementHandle;
SQLRETURN ret = SQL_ERROR;
- FIXME("(StatementHandle %p, Attribute %d, Value %p, StringLength %d)\n", StatementHandle, Attribute, Value,
+ TRACE("(StatementHandle %p, Attribute %d, Value %p, StringLength %d)\n", StatementHandle, Attribute, Value,
StringLength);
+ if (statement->type != SQL_HANDLE_STMT)
+ {
+ WARN("Wrong handle type %d\n", statement->type);
+ return SQL_ERROR;
+ }
+
+ if (statement->connection->pSQLSetStmtAttrW)
+ {
+ 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.43.0

View File

@ -1,41 +0,0 @@
From e2dcd4d6536d1ad99549920cdda96b4ce23b7b05 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Mon, 6 Feb 2023 10:50:26 +1100
Subject: [PATCH] odbc32: Forward SQLParamOptions request onto driver
---
dlls/odbc32/proxyodbc.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
index 999d1e64916..2b1db217467 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -1529,10 +1529,23 @@ SQLRETURN WINAPI SQLNumParams(SQLHSTMT hstmt, SQLSMALLINT *pcpar)
*/
SQLRETURN WINAPI SQLParamOptions(SQLHSTMT hstmt, SQLULEN crow, SQLULEN *pirow)
{
+ struct SQLHSTMT_data *statement = hstmt;
SQLRETURN ret = SQL_ERROR;
- FIXME("(hstmt %p, crow %s, pirow %p)\n", hstmt, debugstr_sqlulen(crow), pirow);
+ TRACE("(hstmt %p, crow %s, pirow %p)\n", hstmt, debugstr_sqlulen(crow), pirow);
+ if (statement->type != SQL_HANDLE_STMT)
+ {
+ WARN("Wrong handle type %d\n", statement->type);
+ return SQL_ERROR;
+ }
+
+ if (statement->connection->pSQLParamOptions)
+ {
+ ret = statement->connection->pSQLParamOptions(statement->driver_stmt, crow, pirow);
+ }
+
+ TRACE("ret %d\n", ret);
return ret;
}
--
2.43.0

View File

@ -1,72 +0,0 @@
From c7285c3ce19b3e5ff0d6a90ff84fa3c497776511 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Mon, 6 Feb 2023 10:53:29 +1100
Subject: [PATCH] odbc32: Forward SQLExecDirect/W request onto driver
---
dlls/odbc32/proxyodbc.c | 36 ++++++++++++++++++++++++++++++++----
1 file changed, 32 insertions(+), 4 deletions(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
index 2b1db217467..6508c9b1d73 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -665,11 +665,25 @@ SQLRETURN WINAPI SQLError(SQLHENV EnvironmentHandle, SQLHDBC ConnectionHandle, S
*/
SQLRETURN WINAPI SQLExecDirect(SQLHSTMT StatementHandle, SQLCHAR *StatementText, SQLINTEGER TextLength)
{
+ struct SQLHSTMT_data *statement = StatementHandle;
SQLRETURN ret = SQL_ERROR;
- 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_an((char*)StatementText, TextLength) : debugstr_a((char*)StatementText),
+ TextLength);
+
+ if (statement->type != SQL_HANDLE_STMT)
+ {
+ WARN("Wrong handle type %d\n", statement->type);
+ return SQL_ERROR;
+ }
+ if (statement->connection->pSQLExecDirect)
+ {
+ ret = statement->connection->pSQLExecDirect(statement->driver_stmt, StatementText, TextLength);
+ }
+
+ TRACE("ret %d\n", ret);
return ret;
}
@@ -1770,11 +1784,25 @@ SQLRETURN WINAPI SQLErrorW(SQLHENV EnvironmentHandle, SQLHDBC ConnectionHandle,
*/
SQLRETURN WINAPI SQLExecDirectW(SQLHSTMT StatementHandle, WCHAR *StatementText, SQLINTEGER TextLength)
{
+ struct SQLHSTMT_data *statement = StatementHandle;
SQLRETURN ret = SQL_ERROR;
- FIXME("(StatementHandle %p, StatementText %s, TextLength %d)\n", StatementHandle,
- debugstr_wn(StatementText, TextLength), TextLength);
+ TRACE("(StatementHandle %p, StatementText %s, TextLength %d)\n", StatementHandle,
+ TextLength > 0 ? debugstr_wn(StatementText, TextLength) : debugstr_w(StatementText),
+ TextLength);
+
+ if (statement->type != SQL_HANDLE_STMT)
+ {
+ WARN("Wrong handle type %d\n", statement->type);
+ return SQL_ERROR;
+ }
+ if (statement->connection->pSQLExecDirectW)
+ {
+ ret = statement->connection->pSQLExecDirectW(statement->driver_stmt, StatementText, TextLength);
+ }
+
+ TRACE("ret %d\n", ret);
return ret;
}
--
2.43.0

View File

@ -1,82 +0,0 @@
From 2f915fc78edc974c6ef926ec3b3b4da81b64b72a Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Mon, 6 Feb 2023 11:04:32 +1100
Subject: [PATCH] odbc32: Forward SQLGetStmtAttr/W onto driver
---
dlls/odbc32/proxyodbc.c | 32 ++++++++++++++++++++++++++++++--
1 file changed, 30 insertions(+), 2 deletions(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
index 6508c9b1d73..ecc208ac21b 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -1028,17 +1028,31 @@ SQLRETURN WINAPI SQLGetInfo(SQLHDBC ConnectionHandle, SQLUSMALLINT InfoType, SQL
SQLRETURN WINAPI SQLGetStmtAttr(SQLHSTMT StatementHandle, SQLINTEGER Attribute, SQLPOINTER Value,
SQLINTEGER BufferLength, SQLINTEGER *StringLength)
{
+ struct SQLHSTMT_data *statement = StatementHandle;
SQLRETURN ret = SQL_ERROR;
- FIXME("(StatementHandle %p, Attribute %d, Value %p, BufferLength %d, StringLength %p)\n", StatementHandle,
+ TRACE("(StatementHandle %p, Attribute %d, Value %p, BufferLength %d, StringLength %p)\n", StatementHandle,
Attribute, Value, BufferLength, StringLength);
+ if (statement->type != SQL_HANDLE_STMT)
+ {
+ WARN("Wrong handle type %d\n", statement->type);
+ return SQL_ERROR;
+ }
+
if (!Value)
{
WARN("Unexpected NULL Value return address\n");
return SQL_ERROR;
}
+ if (statement->connection->pSQLGetStmtAttr)
+ {
+ ret = statement->connection->pSQLGetStmtAttr(statement->driver_stmt, Attribute, Value,
+ BufferLength, StringLength);
+ }
+
+ TRACE("ret %d\n", ret);
return ret;
}
@@ -1964,17 +1978,31 @@ SQLRETURN WINAPI SQLGetDiagRecW(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMA
SQLRETURN WINAPI SQLGetStmtAttrW(SQLHSTMT StatementHandle, SQLINTEGER Attribute, SQLPOINTER Value,
SQLINTEGER BufferLength, SQLINTEGER *StringLength)
{
+ struct SQLHSTMT_data *statement = StatementHandle;
SQLRETURN ret = SQL_ERROR;
- FIXME("(StatementHandle %p, Attribute %d, Value %p, BufferLength %d, StringLength %p)\n", StatementHandle,
+ TRACE("(StatementHandle %p, Attribute %d, Value %p, BufferLength %d, StringLength %p)\n", StatementHandle,
Attribute, Value, BufferLength, StringLength);
+ if (statement->type != SQL_HANDLE_STMT)
+ {
+ WARN("Wrong handle type %d\n", statement->type);
+ return SQL_ERROR;
+ }
+
if (!Value)
{
WARN("Unexpected NULL Value return address\n");
return SQL_ERROR;
}
+ if (statement->connection->pSQLGetStmtAttrW)
+ {
+ ret = statement->connection->pSQLGetStmtAttrW(statement->driver_stmt, Attribute, Value,
+ BufferLength, StringLength);
+ }
+
+ TRACE("ret %d\n", ret);
return ret;
}
--
2.43.0

View File

@ -1,41 +0,0 @@
From 711377cb7cad345eda0432fdf035b6f5466ef1c4 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Mon, 6 Feb 2023 11:08:41 +1100
Subject: [PATCH] odbc32: Forward SQLRowCount onto driver
---
dlls/odbc32/proxyodbc.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
index ecc208ac21b..c76b8ff3c2a 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -1134,10 +1134,23 @@ SQLRETURN WINAPI SQLPutData(SQLHSTMT StatementHandle, SQLPOINTER Data, SQLLEN St
*/
SQLRETURN WINAPI SQLRowCount(SQLHSTMT StatementHandle, SQLLEN *RowCount)
{
+ struct SQLHSTMT_data *statement = StatementHandle;
SQLRETURN ret = SQL_ERROR;
- FIXME("(StatementHandle %p, RowCount %p)\n", StatementHandle, RowCount);
+ TRACE("(StatementHandle %p, RowCount %p)\n", StatementHandle, RowCount);
+ if (statement->type != SQL_HANDLE_STMT)
+ {
+ WARN("Wrong handle type %d\n", statement->type);
+ return SQL_ERROR;
+ }
+
+ if (statement->connection->pSQLRowCount)
+ {
+ ret = statement->connection->pSQLRowCount(statement->driver_stmt, RowCount);
+ }
+
+ TRACE("ret %d\n", ret);
return ret;
}
--
2.43.0

View File

@ -1,41 +0,0 @@
From 1a21b4f8c22e0b8911a9ebd43cc4a5f665192494 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Mon, 6 Feb 2023 11:10:54 +1100
Subject: [PATCH] odbc32: Forward SQLNumResultCols onto driver
---
dlls/odbc32/proxyodbc.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
index c76b8ff3c2a..12b6e9e113b 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -1085,10 +1085,23 @@ SQLRETURN WINAPI SQLGetTypeInfo(SQLHSTMT StatementHandle, SQLSMALLINT DataType)
*/
SQLRETURN WINAPI SQLNumResultCols(SQLHSTMT StatementHandle, SQLSMALLINT *ColumnCount)
{
+ struct SQLHSTMT_data *statement = StatementHandle;
SQLRETURN ret = SQL_ERROR;
- FIXME("(StatementHandle %p, ColumnCount %p)\n", StatementHandle, ColumnCount);
+ TRACE("(StatementHandle %p, ColumnCount %p)\n", StatementHandle, ColumnCount);
+ if (statement->type != SQL_HANDLE_STMT)
+ {
+ WARN("Wrong handle type %d\n", statement->type);
+ return SQL_ERROR;
+ }
+
+ if (statement->connection->pSQLNumResultCols)
+ {
+ ret = statement->connection->pSQLNumResultCols(statement->driver_stmt, ColumnCount);
+ }
+
+ TRACE("ret %d\n", ret);
return ret;
}
--
2.43.0

View File

@ -1,41 +0,0 @@
From cdebd6c62d542e1c4a3e6edd3885e7a14bb796cc Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Mon, 6 Feb 2023 11:12:20 +1100
Subject: [PATCH] odbc32: Forward SQLMoreResults request onto driver
---
dlls/odbc32/proxyodbc.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
index 12b6e9e113b..61877bfb4a7 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -1545,10 +1545,23 @@ SQLRETURN WINAPI SQLForeignKeys(SQLHSTMT hstmt, SQLCHAR *szPkCatalogName, SQLSMA
*/
SQLRETURN WINAPI SQLMoreResults(SQLHSTMT StatementHandle)
{
+ struct SQLHSTMT_data *statement = StatementHandle;
SQLRETURN ret = SQL_ERROR;
- FIXME("(%p)\n", StatementHandle);
+ TRACE("(%p)\n", StatementHandle);
+ if (statement->type != SQL_HANDLE_STMT)
+ {
+ WARN("Wrong handle type %d\n", statement->type);
+ return SQL_ERROR;
+ }
+
+ if (statement->connection->pSQLMoreResults)
+ {
+ ret = statement->connection->pSQLMoreResults(statement->driver_stmt);
+ }
+
+ TRACE("ret %d\n", ret);
return ret;
}
--
2.43.0

View File

@ -1,78 +0,0 @@
From af020a2a8380fc6640ae91385840d624842a428e Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Mon, 6 Feb 2023 11:17:59 +1100
Subject: [PATCH] odbc32: Forward SQLDescribeCol/w request onto driver
---
dlls/odbc32/proxyodbc.c | 35 +++++++++++++++++++++++++++++++++--
1 file changed, 33 insertions(+), 2 deletions(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
index 61877bfb4a7..ae7794917f3 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -597,12 +597,29 @@ SQLRETURN WINAPI SQLDescribeCol(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNum
SQLSMALLINT BufferLength, SQLSMALLINT *NameLength, SQLSMALLINT *DataType,
SQLULEN *ColumnSize, SQLSMALLINT *DecimalDigits, SQLSMALLINT *Nullable)
{
+ struct SQLHSTMT_data *statement = StatementHandle;
+ SQLSMALLINT dummy;
SQLRETURN ret = SQL_ERROR;
- FIXME("(StatementHandle %p, ColumnNumber %d, ColumnName %p, BufferLength %d, NameLength %p, DataType %p,"
+ TRACE("(StatementHandle %p, ColumnNumber %d, ColumnName %p, BufferLength %d, NameLength %p, DataType %p,"
" ColumnSize %p, DecimalDigits %p, Nullable %p)\n", StatementHandle, ColumnNumber, ColumnName,
BufferLength, NameLength, DataType, ColumnSize, DecimalDigits, Nullable);
+ if (!NameLength) NameLength = &dummy; /* workaround for drivers that don't accept NULL NameLength */
+
+ if (statement->type != SQL_HANDLE_STMT)
+ {
+ WARN("Wrong handle type %d\n", statement->type);
+ return SQL_ERROR;
+ }
+
+ if (statement->connection->pSQLDescribeCol)
+ {
+ ret = statement->connection->pSQLDescribeCol(statement->driver_stmt, ColumnNumber, ColumnName,
+ BufferLength, NameLength, DataType, ColumnSize, DecimalDigits, Nullable);
+ }
+
+ TRACE("ret %d\n", ret);
return ret;
}
@@ -1804,15 +1821,29 @@ SQLRETURN WINAPI SQLDescribeColW(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNu
SQLSMALLINT BufferLength, SQLSMALLINT *NameLength, SQLSMALLINT *DataType,
SQLULEN *ColumnSize, SQLSMALLINT *DecimalDigits, SQLSMALLINT *Nullable)
{
+ struct SQLHSTMT_data *statement = StatementHandle;
SQLSMALLINT dummy;
SQLRETURN ret = SQL_ERROR;
- FIXME("(StatementHandle %p, ColumnNumber %d, ColumnName %p, BufferLength %d, NameLength %p, DataType %p,"
+ TRACE("(StatementHandle %p, ColumnNumber %d, ColumnName %p, BufferLength %d, NameLength %p, DataType %p,"
" ColumnSize %p, DecimalDigits %p, Nullable %p)\n", StatementHandle, ColumnNumber, ColumnName,
BufferLength, NameLength, DataType, ColumnSize, DecimalDigits, Nullable);
if (!NameLength) NameLength = &dummy; /* workaround for drivers that don't accept NULL NameLength */
+ if (statement->type != SQL_HANDLE_STMT)
+ {
+ WARN("Wrong handle type %d\n", statement->type);
+ return SQL_ERROR;
+ }
+
+ if (statement->connection->pSQLDescribeColW)
+ {
+ ret = statement->connection->pSQLDescribeColW(statement->driver_stmt, ColumnNumber, ColumnName,
+ BufferLength, NameLength, DataType, ColumnSize, DecimalDigits, Nullable);
+ }
+
+ TRACE("ret %d\n", ret);
return ret;
}
--
2.43.0

View File

@ -1,100 +0,0 @@
From 575797d61cb119102a9db030ee57e20e0ce466c6 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Mon, 6 Feb 2023 11:30:58 +1100
Subject: [PATCH] odbc32: Forward SQLColAttributes/W request onto driver
---
dlls/odbc32/proxyodbc.c | 55 +++++++++++++++++++++++++++++++++++++++--
1 file changed, 53 insertions(+), 2 deletions(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
index ae7794917f3..b4f143dab45 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -1478,11 +1478,26 @@ SQLRETURN WINAPI SQLColAttributes(SQLHSTMT hstmt, SQLUSMALLINT icol, SQLUSMALLIN
SQLPOINTER rgbDesc, SQLSMALLINT cbDescMax, SQLSMALLINT *pcbDesc,
SQLLEN *pfDesc)
{
+ struct SQLHSTMT_data *statement = hstmt;
SQLRETURN ret = SQL_ERROR;
- FIXME("(hstmt %p, icol %d, fDescType %d, rgbDesc %p, cbDescMax %d, pcbDesc %p, pfDesc %p)\n", hstmt, icol,
+ TRACE("(hstmt %p, icol %d, fDescType %d, rgbDesc %p, cbDescMax %d, pcbDesc %p, pfDesc %p)\n", hstmt, icol,
fDescType, rgbDesc, cbDescMax, pcbDesc, pfDesc);
+ if (statement->type != SQL_HANDLE_STMT)
+ {
+ WARN("Wrong handle type %d\n", statement->type);
+ return SQL_ERROR;
+ }
+
+ if (statement->connection->pSQLColAttributes)
+ {
+ ret = statement->connection->pSQLColAttributes(statement->driver_stmt, icol, fDescType,
+ rgbDesc, cbDescMax, pcbDesc, pfDesc);
+ }
+
+ TRACE("ret %d\n", ret);
+
return ret;
}
@@ -1783,6 +1798,21 @@ SQLRETURN WINAPI SQLSetScrollOptions(SQLHSTMT statement_handle, SQLUSMALLINT f_c
return ret;
}
+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]
*/
@@ -1790,11 +1820,32 @@ SQLRETURN WINAPI SQLColAttributesW(SQLHSTMT hstmt, SQLUSMALLINT icol, SQLUSMALLI
SQLPOINTER rgbDesc, SQLSMALLINT cbDescMax, SQLSMALLINT *pcbDesc,
SQLLEN *pfDesc)
{
+ struct SQLHSTMT_data *statement = hstmt;
SQLRETURN ret = SQL_ERROR;
- FIXME("(hstmt %p, icol %d, fDescType %d, rgbDesc %p, cbDescMax %d, pcbDesc %p, pfDesc %p)\n", hstmt, icol,
+ TRACE("(hstmt %p, icol %d, fDescType %d, rgbDesc %p, cbDescMax %d, pcbDesc %p, pfDesc %p)\n", hstmt, icol,
fDescType, rgbDesc, cbDescMax, pcbDesc, pfDesc);
+ if (statement->type != SQL_HANDLE_STMT)
+ {
+ WARN("Wrong handle type %d\n", statement->type);
+ return SQL_ERROR;
+ }
+
+ /* Default to ODBC 3.x */
+ if (statement->connection->pSQLColAttributeW)
+ {
+ fDescType = map_odbc2_to_3(fDescType);
+ ret = statement->connection->pSQLColAttributeW(statement->driver_stmt, icol, fDescType,
+ rgbDesc, cbDescMax, pcbDesc, pfDesc);
+ }
+ else if (statement->connection->pSQLColAttributesW)
+ {
+ ret = statement->connection->pSQLColAttributesW(statement->driver_stmt, icol, fDescType,
+ rgbDesc, cbDescMax, pcbDesc, pfDesc);
+ }
+
+ TRACE("ret %d\n", ret);
return ret;
}
--
2.43.0

View File

@ -1,70 +0,0 @@
From 3bd355283d087071c17eab5f4799f092dd42d8d1 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Mon, 6 Feb 2023 11:36:33 +1100
Subject: [PATCH] odbc32: Forward SQLNativeSql/W request onto driver
---
dlls/odbc32/proxyodbc.c | 32 ++++++++++++++++++++++++++++++--
1 file changed, 30 insertions(+), 2 deletions(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
index b4f143dab45..6e599a385a1 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -1603,11 +1603,25 @@ SQLRETURN WINAPI SQLMoreResults(SQLHSTMT StatementHandle)
SQLRETURN WINAPI SQLNativeSql(SQLHDBC hdbc, SQLCHAR *szSqlStrIn, SQLINTEGER cbSqlStrIn, SQLCHAR *szSqlStr,
SQLINTEGER cbSqlStrMax, SQLINTEGER *pcbSqlStr)
{
+ struct SQLHDBC_data *connection = hdbc;
SQLRETURN ret = SQL_ERROR;
- FIXME("(hdbc %p, szSqlStrIn %s, cbSqlStrIn %d, szSqlStr %p, cbSqlStrMax %d, pcbSqlStr %p)\n", hdbc,
+ TRACE("(hdbc %p, szSqlStrIn %s, cbSqlStrIn %d, szSqlStr %p, cbSqlStrMax %d, pcbSqlStr %p)\n", hdbc,
debugstr_an((const char *)szSqlStrIn, cbSqlStrIn), cbSqlStrIn, szSqlStr, cbSqlStrMax, pcbSqlStr);
+ if (connection->type != SQL_HANDLE_DBC)
+ {
+ WARN("Wrong handle type %d\n", connection->type);
+ return SQL_ERROR;
+ }
+
+ if (connection->pSQLNativeSql)
+ {
+ ret = connection->pSQLNativeSql(connection->driver_hdbc, szSqlStrIn, cbSqlStrIn,
+ szSqlStr, cbSqlStrMax, pcbSqlStr);
+ }
+
+ TRACE("ret %d\n", ret);
return ret;
}
@@ -2531,11 +2545,25 @@ SQLRETURN WINAPI SQLForeignKeysW(SQLHSTMT hstmt, SQLWCHAR *szPkCatalogName, SQLS
SQLRETURN WINAPI SQLNativeSqlW(SQLHDBC hdbc, SQLWCHAR *szSqlStrIn, SQLINTEGER cbSqlStrIn, SQLWCHAR *szSqlStr,
SQLINTEGER cbSqlStrMax, SQLINTEGER *pcbSqlStr)
{
+ struct SQLHDBC_data *connection = hdbc;
SQLRETURN ret = SQL_ERROR;
- FIXME("(hdbc %p, szSqlStrIn %s, cbSqlStrIn %d, szSqlStr %p, cbSqlStrMax %d, pcbSqlStr %p)\n", hdbc,
+ TRACE("(hdbc %p, szSqlStrIn %s, cbSqlStrIn %d, szSqlStr %p, cbSqlStrMax %d, pcbSqlStr %p)\n", hdbc,
debugstr_wn(szSqlStrIn, cbSqlStrIn), cbSqlStrIn, szSqlStr, cbSqlStrMax, pcbSqlStr);
+ if (connection->type != SQL_HANDLE_DBC)
+ {
+ WARN("Wrong handle type %d\n", connection->type);
+ return SQL_ERROR;
+ }
+
+ if (connection->pSQLNativeSqlW)
+ {
+ ret = connection->pSQLNativeSqlW(connection->driver_hdbc, szSqlStrIn, cbSqlStrIn,
+ szSqlStr, cbSqlStrMax, pcbSqlStr);
+ }
+
+ TRACE("ret %d\n", ret);
return ret;
}
--
2.43.0

View File

@ -1,71 +0,0 @@
From 69dc39b9dbf854da2f2b21069ca6407de8fc77e0 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Mon, 6 Feb 2023 11:44:00 +1100
Subject: [PATCH] odbc32: Forward SQLPrepare/W request onto driver
---
dlls/odbc32/proxyodbc.c | 34 +++++++++++++++++++++++++++++++---
1 file changed, 31 insertions(+), 3 deletions(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
index 6e599a385a1..12d75fd1fcc 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -1139,11 +1139,25 @@ SQLRETURN WINAPI SQLParamData(SQLHSTMT StatementHandle, SQLPOINTER *Value)
*/
SQLRETURN WINAPI SQLPrepare(SQLHSTMT StatementHandle, SQLCHAR *StatementText, SQLINTEGER TextLength)
{
+ struct SQLHSTMT_data *statement = StatementHandle;
SQLRETURN ret = SQL_ERROR;
FIXME("(StatementHandle %p, StatementText %s, TextLength %d)\n", StatementHandle,
- debugstr_an((const char *)StatementText, TextLength), TextLength);
+ TextLength > 0 ? debugstr_an((const char *)StatementText, TextLength) : debugstr_a((const char *)StatementText),
+ TextLength);
+
+ if (statement->type != SQL_HANDLE_STMT)
+ {
+ WARN("Wrong handle type %d\n", statement->type);
+ return SQL_ERROR;
+ }
+
+ if (statement->connection->pSQLPrepare)
+ {
+ ret = statement->connection->pSQLPrepare(statement->driver_stmt, StatementText, TextLength);
+ }
+ TRACE("ret %d\n", ret);
return ret;
}
@@ -1974,11 +1988,25 @@ SQLRETURN WINAPI SQLGetCursorNameW(SQLHSTMT StatementHandle, WCHAR *CursorName,
*/
SQLRETURN WINAPI SQLPrepareW(SQLHSTMT StatementHandle, WCHAR *StatementText, SQLINTEGER TextLength)
{
+ struct SQLHSTMT_data *statement = StatementHandle;
SQLRETURN ret = SQL_ERROR;
- FIXME("(StatementHandle %p, StatementText %s, TextLength %d)\n", StatementHandle,
- debugstr_wn(StatementText, TextLength), TextLength);
+ TRACE("(StatementHandle %p, StatementText %s, TextLength %d)\n", StatementHandle,
+ TextLength > 0 ? debugstr_wn(StatementText, TextLength) : debugstr_w(StatementText),
+ TextLength);
+ if (statement->type != SQL_HANDLE_STMT)
+ {
+ WARN("Wrong handle type %d\n", statement->type);
+ return SQL_ERROR;
+ }
+
+ if (statement->connection->pSQLPrepareW)
+ {
+ ret = statement->connection->pSQLPrepareW(statement->driver_stmt, StatementText, TextLength);
+ }
+
+ TRACE("ret %d\n", ret);
return ret;
}
--
2.43.0

View File

@ -1,41 +0,0 @@
From bf680aa668ce942e0f7d37333c3680561ec45b84 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Mon, 6 Feb 2023 11:47:40 +1100
Subject: [PATCH] odbc32: Implement SQLFreeStmt
---
dlls/odbc32/proxyodbc.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
index 12d75fd1fcc..c457c4ac203 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -799,10 +799,23 @@ SQLRETURN WINAPI SQLFreeHandle(SQLSMALLINT HandleType, SQLHANDLE Handle)
*/
SQLRETURN WINAPI SQLFreeStmt(SQLHSTMT StatementHandle, SQLUSMALLINT Option)
{
+ struct SQLHSTMT_data *statement = StatementHandle;
SQLRETURN ret = SQL_ERROR;
- FIXME("(StatementHandle %p, Option %d)\n", StatementHandle, Option);
+ TRACE("(StatementHandle %p, Option %d)\n", StatementHandle, Option);
+ if (statement->type != SQL_HANDLE_STMT)
+ {
+ WARN("Wrong handle type %d\n", statement->type);
+ return SQL_ERROR;
+ }
+
+ if (statement->connection->pSQLFreeStmt)
+ {
+ ret = statement->connection->pSQLFreeStmt(statement->driver_stmt, Option);
+ }
+
+ TRACE("ret %d\n", ret);
return ret;
}
--
2.43.0

View File

@ -1,43 +0,0 @@
From 3a2481213f3f96ab6befa4b052d1c7266cb82af6 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Mon, 6 Feb 2023 11:57:00 +1100
Subject: [PATCH] odbc32: Forward SQLBindCol requets onto 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 c457c4ac203..257375f568a 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -438,11 +438,25 @@ static const char *debugstr_sqllen( SQLLEN len )
SQLRETURN WINAPI SQLBindCol(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber, SQLSMALLINT TargetType,
SQLPOINTER TargetValue, SQLLEN BufferLength, SQLLEN *StrLen_or_Ind)
{
+ struct SQLHSTMT_data *statement = StatementHandle;
SQLRETURN ret = SQL_ERROR;
- FIXME("(StatementHandle %p, ColumnNumber %d, TargetType %d, TargetValue %p, BufferLength %s, StrLen_or_Ind %p)\n",
+ TRACE("(StatementHandle %p, ColumnNumber %d, TargetType %d, TargetValue %p, BufferLength %s, StrLen_or_Ind %p)\n",
StatementHandle, ColumnNumber, TargetType, TargetValue, debugstr_sqllen(BufferLength), StrLen_or_Ind);
+ if (statement->type != SQL_HANDLE_STMT)
+ {
+ WARN("Wrong handle type %d\n", statement->type);
+ return SQL_ERROR;
+ }
+
+ if (statement->connection->pSQLBindCol)
+ {
+ ret = statement->connection->pSQLBindCol(statement->driver_stmt, ColumnNumber, TargetType,
+ TargetValue, BufferLength, StrLen_or_Ind);
+ }
+
+ TRACE("ret %d\n", ret);
return ret;
}
--
2.43.0

View File

@ -1,43 +0,0 @@
From 4b29416728af78c52d707adacc3d8ca7ffa01cd6 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Mon, 6 Feb 2023 12:35:26 +1100
Subject: [PATCH] odbc32: Forward SQLExtendedFetch request onto 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 257375f568a..de63be77ce2 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -1581,11 +1581,25 @@ SQLRETURN WINAPI SQLDescribeParam(SQLHSTMT hstmt, SQLUSMALLINT ipar, SQLSMALLINT
SQLRETURN WINAPI SQLExtendedFetch(SQLHSTMT hstmt, SQLUSMALLINT fFetchType, SQLLEN irow, SQLULEN *pcrow,
SQLUSMALLINT *rgfRowStatus)
{
+ struct SQLHSTMT_data *statement = hstmt;
SQLRETURN ret = SQL_ERROR;
- FIXME("(hstmt %p, fFetchType %d, irow %s, pcrow %p, rgfRowStatus %p)\n", hstmt, fFetchType, debugstr_sqllen(irow),
+ TRACE("(hstmt %p, fFetchType %d, irow %s, pcrow %p, rgfRowStatus %p)\n", hstmt, fFetchType, debugstr_sqllen(irow),
pcrow, rgfRowStatus);
+ if (statement->type != SQL_HANDLE_STMT)
+ {
+ WARN("Wrong handle type %d\n", statement->type);
+ return SQL_ERROR;
+ }
+
+ if (statement->connection->pSQLExtendedFetch)
+ {
+ ret = statement->connection->pSQLExtendedFetch(statement->driver_stmt, fFetchType, irow,
+ pcrow, rgfRowStatus);
+ }
+
+ TRACE("ret %d\n", ret);
return ret;
}
--
2.43.0

View File

@ -1,41 +0,0 @@
From 3af824cbff508603882029571b0799fa61c6526f Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Mon, 6 Feb 2023 13:14:19 +1100
Subject: [PATCH] odbc32: Forward SQLExecute request onto driver
---
dlls/odbc32/proxyodbc.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
index de63be77ce2..6dd8f9ac0fb 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -735,10 +735,23 @@ SQLRETURN WINAPI SQLExecute(SQLHSTMT StatementHandle)
*/
SQLRETURN WINAPI SQLFetch(SQLHSTMT StatementHandle)
{
+ struct SQLHSTMT_data *statement = StatementHandle;
SQLRETURN ret = SQL_ERROR;
- FIXME("(StatementHandle %p)\n", StatementHandle);
+ TRACE("(StatementHandle %p)\n", StatementHandle);
+
+ if (statement->type != SQL_HANDLE_STMT)
+ {
+ WARN("Wrong handle type %d\n", statement->type);
+ return SQL_ERROR;
+ }
+
+ if (statement->connection->pSQLFetch)
+ {
+ ret = statement->connection->pSQLFetch(statement->driver_stmt);
+ }
+ TRACE("ret %d\n", ret);
return ret;
}
--
2.43.0

View File

@ -1,82 +0,0 @@
From 3c2a0b102b6525589dfc58a481a9b769f2d40c57 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] odbc32: Forward SQLGetDiagField/W request onto driver
---
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 6dd8f9ac0fb..ac30e8aed81 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -959,9 +959,31 @@ SQLRETURN WINAPI SQLGetDiagField(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSM
{
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,"
" StringLength %p)\n", HandleType, Handle, RecNumber, DiagIdentifier, DiagInfo, BufferLength, StringLength);
+ 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->pSQLGetDiagField)
+ ret = hdbc->pSQLGetDiagField(HandleType, hdbc->driver_hdbc, RecNumber, DiagIdentifier,
+ DiagInfo, BufferLength, StringLength);
+ }
+ else if (HandleType == SQL_HANDLE_STMT)
+ {
+ struct SQLHSTMT_data *statement = Handle;
+
+ if (statement->connection->pSQLGetDiagField)
+ ret = statement->connection->pSQLGetDiagField(HandleType, statement->driver_stmt, RecNumber,
+ DiagIdentifier, DiagInfo, BufferLength, StringLength);
+ }
+
+ TRACE("ret %d\n", ret);
return ret;
}
@@ -2167,9 +2189,31 @@ SQLRETURN WINAPI SQLGetDiagFieldW(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLS
{
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,"
" StringLength %p)\n", HandleType, Handle, RecNumber, DiagIdentifier, DiagInfo, BufferLength, StringLength);
+ 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->pSQLGetDiagFieldW)
+ ret = hdbc->pSQLGetDiagFieldW(HandleType, hdbc->driver_hdbc, RecNumber, DiagIdentifier,
+ DiagInfo, BufferLength, StringLength);
+ }
+ else if (HandleType == SQL_HANDLE_STMT)
+ {
+ struct SQLHSTMT_data *statement = Handle;
+
+ if (statement->connection->pSQLGetDiagFieldW)
+ ret = statement->connection->pSQLGetDiagFieldW(HandleType, statement->driver_stmt, RecNumber,
+ DiagIdentifier, DiagInfo, BufferLength, StringLength);
+ }
+
+ TRACE("ret %d\n", ret);
return ret;
}
--
2.43.0

View File

@ -1,124 +0,0 @@
From 9da2063aee1a4ffc92b76e204392bad4fcb63431 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Mon, 6 Feb 2023 14:00:41 +1100
Subject: [PATCH] odbc32: SQLGetStmtAttr store some driver HDESC values
---
dlls/odbc32/proxyodbc.c | 81 +++++++++++++++++++++++++++++++++++++++--
1 file changed, 78 insertions(+), 3 deletions(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
index ac30e8aed81..62f8fdc40a5 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -174,11 +174,22 @@ struct SQLHDBC_data
SQLUINTEGER login_timeout;
};
+struct SQLHDESC_data
+{
+ struct SQLHSTMT_data *parent;
+ SQLHDESC driver_hdesc;
+};
+
struct SQLHSTMT_data
{
int type;
struct SQLHDBC_data *connection;
SQLHSTMT driver_stmt;
+
+ struct SQLHDESC_data app_row_desc;
+ struct SQLHDESC_data imp_row_desc;
+ struct SQLHDESC_data app_param_desc;
+ struct SQLHDESC_data imp_param_desc;
};
static void connection_bind_sql_funcs(struct SQLHDBC_data *connection)
@@ -1127,8 +1138,40 @@ SQLRETURN WINAPI SQLGetStmtAttr(SQLHSTMT StatementHandle, SQLINTEGER Attribute,
if (statement->connection->pSQLGetStmtAttr)
{
- ret = statement->connection->pSQLGetStmtAttr(statement->driver_stmt, Attribute, Value,
+ switch(Attribute)
+ {
+ case SQL_ATTR_APP_ROW_DESC:
+ statement->app_row_desc.parent = statement;
+ ret = statement->connection->pSQLGetStmtAttr(statement->driver_stmt, Attribute,
+ &statement->app_row_desc.driver_hdesc,
+ BufferLength, StringLength);
+ *((SQLHDESC*)Value) = &statement->app_row_desc;
+ break;
+ case SQL_ATTR_IMP_ROW_DESC:
+ statement->imp_row_desc.parent = statement;
+ ret = statement->connection->pSQLGetStmtAttr(statement->driver_stmt, Attribute,
+ &statement->imp_row_desc.driver_hdesc,
+ BufferLength, StringLength);
+ *((SQLHDESC*)Value) = &statement->imp_row_desc;
+ break;
+ case SQL_ATTR_APP_PARAM_DESC:
+ statement->app_param_desc.parent = statement;
+ ret = statement->connection->pSQLGetStmtAttr(statement->driver_stmt, Attribute,
+ &statement->app_param_desc.driver_hdesc,
+ BufferLength, StringLength);
+ *((SQLHDESC*)Value) = &statement->app_param_desc;
+ break;
+ case SQL_ATTR_IMP_PARAM_DESC:
+ statement->imp_param_desc.parent = statement;
+ ret = statement->connection->pSQLGetStmtAttr(statement->driver_stmt, Attribute,
+ &statement->imp_param_desc.driver_hdesc,
+ BufferLength, StringLength);
+ *((SQLHDESC*)Value) = &statement->imp_param_desc;
+ break;
+ default:
+ ret = statement->connection->pSQLGetStmtAttr(statement->driver_stmt, Attribute, Value,
BufferLength, StringLength);
+ }
}
TRACE("ret %d\n", ret);
@@ -2259,8 +2302,40 @@ SQLRETURN WINAPI SQLGetStmtAttrW(SQLHSTMT StatementHandle, SQLINTEGER Attribute,
if (statement->connection->pSQLGetStmtAttrW)
{
- ret = statement->connection->pSQLGetStmtAttrW(statement->driver_stmt, Attribute, Value,
- BufferLength, StringLength);
+ switch(Attribute)
+ {
+ case SQL_ATTR_APP_ROW_DESC:
+ statement->app_row_desc.parent = statement;
+ ret = statement->connection->pSQLGetStmtAttrW(statement->driver_stmt, Attribute,
+ &statement->app_row_desc.driver_hdesc,
+ BufferLength, StringLength);
+ *((SQLHDESC*)Value) = &statement->app_row_desc;
+ break;
+ case SQL_ATTR_IMP_ROW_DESC:
+ statement->imp_row_desc.parent = statement;
+ ret = statement->connection->pSQLGetStmtAttrW(statement->driver_stmt, Attribute,
+ &statement->imp_row_desc.driver_hdesc,
+ BufferLength, StringLength);
+ *((SQLHDESC*)Value) = &statement->imp_row_desc;
+ break;
+ case SQL_ATTR_APP_PARAM_DESC:
+ statement->app_param_desc.parent = statement;
+ ret = statement->connection->pSQLGetStmtAttrW(statement->driver_stmt, Attribute,
+ &statement->app_param_desc.driver_hdesc,
+ BufferLength, StringLength);
+ *((SQLHDESC*)Value) = &statement->app_param_desc;
+ break;
+ case SQL_ATTR_IMP_PARAM_DESC:
+ statement->imp_param_desc.parent = statement;
+ ret = statement->connection->pSQLGetStmtAttrW(statement->driver_stmt, Attribute,
+ &statement->imp_param_desc.driver_hdesc,
+ BufferLength, StringLength);
+ *((SQLHDESC*)Value) = &statement->imp_param_desc;
+ break;
+ default:
+ ret = statement->connection->pSQLGetStmtAttrW(statement->driver_stmt, Attribute, Value,
+ BufferLength, StringLength);
+ }
}
TRACE("ret %d\n", ret);
--
2.43.0

View File

@ -1,43 +0,0 @@
From 2a12908474e8cbd6c032d0af426f66b0c3ac2f7f 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 | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
index 62f8fdc40a5..f7032a66ca6 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -2186,6 +2186,7 @@ SQLRETURN WINAPI SQLGetConnectAttrW(SQLHDBC ConnectionHandle, SQLINTEGER Attribu
{
ret = connection->pSQLGetConnectOptionW(connection->driver_hdbc, Attribute, Value);
}
+ TRACE("ret %d\n", ret);
TRACE("ret %d\n", ret);
@@ -2860,11 +2861,17 @@ SQLRETURN WINAPI SQLDriversW(SQLHENV EnvironmentHandle, SQLUSMALLINT fDirection,
SQLRETURN WINAPI SQLSetDescFieldW(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier,
SQLPOINTER Value, SQLINTEGER BufferLength)
{
+ struct SQLHDESC_data *hdesc = DescriptorHandle;
SQLRETURN ret = SQL_ERROR;
- FIXME("(DescriptorHandle %p, RecNumber %d, FieldIdentifier %d, Value %p, BufferLength %d)\n", DescriptorHandle,
+ TRACE("(DescriptorHandle %p, RecNumber %d, FieldIdentifier %d, Value %p, BufferLength %d)\n", DescriptorHandle,
RecNumber, FieldIdentifier, Value, BufferLength);
+ if (hdesc->parent->connection->pSQLSetDescFieldW)
+ ret = hdesc->parent->connection->pSQLSetDescFieldW(hdesc->driver_hdesc, RecNumber, FieldIdentifier,
+ Value, BufferLength);
+ TRACE("ret %d\n", ret);
+
return ret;
}
--
2.43.0

View File

@ -1,53 +0,0 @@
From cd89d8e94f385756bc6c5505c44401cf2e69abb1 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] odbc32: Forward SQLGetData request onto driver
---
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 f7032a66ca6..c8e715bdd67 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -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)
{
+ struct SQLHSTMT_data *statement = StatementHandle;
SQLRETURN ret = SQL_ERROR;
- FIXME("(StatementHandle %p, ColumnNumber %d, TargetType %d, TargetValue %p, BufferLength %s, StrLen_or_Ind %p)\n",
+ TRACE("(StatementHandle %p, ColumnNumber %d, TargetType %d, TargetValue %p, BufferLength %s, StrLen_or_Ind %p)\n",
StatementHandle, ColumnNumber, TargetType, TargetValue, debugstr_sqllen(BufferLength), StrLen_or_Ind);
+ if (statement->type != SQL_HANDLE_STMT)
+ {
+ WARN("Wrong handle type %d\n", statement->type);
+ return SQL_ERROR;
+ }
+
+ 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);
+ }
+
+ TRACE("ret %d\n", ret);
return ret;
}
--
2.43.0

View File

@ -1,66 +0,0 @@
From d84771b086426a52b39dff76e07530eda7096072 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Mon, 6 Feb 2023 15:23:30 +1100
Subject: [PATCH] odbc32: Forward SQLGetTypeInfo/W request onto driver
---
dlls/odbc32/proxyodbc.c | 30 ++++++++++++++++++++++++++++--
1 file changed, 28 insertions(+), 2 deletions(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
index c8e715bdd67..fd8e78f451b 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -1219,10 +1219,23 @@ SQLRETURN WINAPI SQLGetStmtOption(SQLHSTMT StatementHandle, SQLUSMALLINT Option,
*/
SQLRETURN WINAPI SQLGetTypeInfo(SQLHSTMT StatementHandle, SQLSMALLINT DataType)
{
+ struct SQLHSTMT_data *statement = StatementHandle;
SQLRETURN ret = SQL_ERROR;
- FIXME("(StatementHandle %p, DataType %d)\n", StatementHandle, DataType);
+ TRACE("(StatementHandle %p, DataType %d)\n", StatementHandle, DataType);
+ if (statement->type != SQL_HANDLE_STMT)
+ {
+ WARN("Wrong handle type %d\n", statement->type);
+ return SQL_ERROR;
+ }
+
+ if (statement->connection->pSQLGetTypeInfo)
+ {
+ ret = statement->connection->pSQLGetTypeInfo(statement->driver_stmt, DataType);
+ }
+
+ TRACE("ret %d\n", ret);
return ret;
}
@@ -2620,10 +2633,23 @@ SQLRETURN WINAPI SQLGetInfoW(SQLHDBC ConnectionHandle, SQLUSMALLINT InfoType, SQ
*/
SQLRETURN WINAPI SQLGetTypeInfoW(SQLHSTMT StatementHandle, SQLSMALLINT DataType)
{
+ struct SQLHSTMT_data *statement = StatementHandle;
SQLRETURN ret = SQL_ERROR;
- FIXME("(StatementHandle %p, DataType %d)\n", StatementHandle, DataType);
+ TRACE("(StatementHandle %p, DataType %d)\n", StatementHandle, DataType);
+ if (statement->type != SQL_HANDLE_STMT)
+ {
+ WARN("Wrong handle type %d\n", statement->type);
+ return SQL_ERROR;
+ }
+
+ if (statement->connection->pSQLGetTypeInfoW)
+ {
+ ret = statement->connection->pSQLGetTypeInfoW(statement->driver_stmt, DataType);
+ }
+
+ TRACE("ret %d\n", ret);
return ret;
}
--
2.43.0

View File

@ -1,65 +0,0 @@
From dc9fe6444cb0c42d70cf78032cdb4808fed5eb68 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Mon, 6 Feb 2023 15:40:24 +1100
Subject: [PATCH] odbc32: Forward SQLBindParameter request onto driver
---
dlls/odbc32/proxyodbc.c | 37 ++++++++++++++++++++++++++++++++++++-
1 file changed, 36 insertions(+), 1 deletion(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
index fd8e78f451b..f2ece198084 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -1942,12 +1942,47 @@ SQLRETURN WINAPI SQLBindParameter(SQLHSTMT hstmt, SQLUSMALLINT ipar, SQLSMALLINT
SQLSMALLINT ibScale, SQLPOINTER rgbValue, SQLLEN cbValueMax,
SQLLEN *pcbValue)
{
+ struct SQLHSTMT_data *statement = hstmt;
SQLRETURN ret = SQL_ERROR;
- FIXME("(hstmt %p, ipar %d, fParamType %d, fCType %d, fSqlType %d, cbColDef %s, ibScale %d, rgbValue %p,"
+ TRACE("(hstmt %p, ipar %d, fParamType %d, fCType %d, fSqlType %d, cbColDef %s, ibScale %d, rgbValue %p,"
" cbValueMax %s, pcbValue %p)\n", hstmt, ipar, fParamType, fCType, fSqlType, debugstr_sqlulen(cbColDef),
ibScale, rgbValue, debugstr_sqllen(cbValueMax), pcbValue);
+ if (statement->type != SQL_HANDLE_STMT)
+ {
+ WARN("Wrong handle type %d\n", statement->type);
+ return SQL_ERROR;
+ }
+
+ if (statement->connection->pSQLBindParameter)
+ {
+ ret = statement->connection->pSQLBindParameter(statement->driver_stmt, ipar, fParamType,
+ fCType, fSqlType, cbColDef, ibScale, rgbValue, cbValueMax, pcbValue);
+ }
+ else if(statement->connection->pSQLBindParam)
+ {
+ /* TODO: Make function */
+ if(fCType == SQL_C_TYPE_TIME)
+ fCType = SQL_C_TIME;
+ else if(fCType == SQL_C_TYPE_DATE)
+ fCType = SQL_C_DATE;
+ else if(fCType == SQL_C_TYPE_TIMESTAMP)
+ fCType = SQL_C_TIMESTAMP;
+
+ /* TODO: Make function */
+ if (fSqlType == SQL_TIME)
+ fSqlType = SQL_TYPE_TIME;
+ else if (fSqlType == SQL_DATE)
+ fSqlType = SQL_TYPE_DATE;
+ else if (fSqlType == SQL_TIMESTAMP)
+ fSqlType = SQL_TYPE_TIMESTAMP;
+
+ ret = statement->connection->pSQLBindParam(statement->driver_stmt, ipar, fCType, fSqlType,
+ cbColDef, ibScale, rgbValue, pcbValue);
+ }
+
+ TRACE("ret %d\n", ret);
return ret;
}
--
2.43.0

View File

@ -1,42 +0,0 @@
From 931936f51db30da1b5d0583a9be3231b0f7678f0 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Mon, 6 Feb 2023 16:03:58 +1100
Subject: [PATCH] odbc32: Forward SQLTransact request onto driver
---
dlls/odbc32/proxyodbc.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
index f2ece198084..e78b51d7486 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -1591,11 +1591,24 @@ SQLRETURN WINAPI SQLTables(SQLHSTMT StatementHandle, SQLCHAR *CatalogName, SQLSM
*/
SQLRETURN WINAPI SQLTransact(SQLHENV EnvironmentHandle, SQLHDBC ConnectionHandle, SQLUSMALLINT CompletionType)
{
+ struct SQLHDBC_data *connection = ConnectionHandle;
SQLRETURN ret = SQL_ERROR;
- FIXME("(EnvironmentHandle %p, ConnectionHandle %p, CompletionType %d)\n", EnvironmentHandle, ConnectionHandle,
+ TRACE("(EnvironmentHandle %p, ConnectionHandle %p, CompletionType %d)\n", EnvironmentHandle, ConnectionHandle,
CompletionType);
+ if (connection->type != SQL_HANDLE_DBC)
+ {
+ WARN("Wrong connection handle type %d\n", connection->type);
+ return SQL_ERROR;
+ }
+
+ if (connection->pSQLTransact)
+ {
+ ret = connection->pSQLTransact(connection->driver_env, connection->driver_hdbc, CompletionType);
+ }
+
+ TRACE("ret %d\n", ret);
return ret;
}
--
2.43.0

View File

@ -1,68 +0,0 @@
From 76ed07ea89b4375d721fb993e04b4c99b3592996 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Tue, 7 Feb 2023 14:18:20 +1100
Subject: [PATCH] odbc32: Forward SQLGetDiagRecW request onto driver
---
dlls/odbc32/proxyodbc.c | 42 ++++++++++++++++++++++++++++++++++++++++-
1 file changed, 41 insertions(+), 1 deletion(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
index e78b51d7486..b8c2eb43055 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -2355,10 +2355,50 @@ SQLRETURN WINAPI SQLGetDiagRecW(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->pSQLGetDiagRecW)
+ {
+ ret = hdbc->pSQLGetDiagRecW(HandleType, hdbc->driver_hdbc, RecNumber, Sqlstate,
+ NativeError, MessageText, BufferLength, TextLength);
+ }
+ else if (hdbc->pSQLErrorW)
+ {
+ ret = hdbc->pSQLErrorW(SQL_NULL_HENV, hdbc->driver_hdbc, SQL_NULL_HSTMT, Sqlstate,
+ NativeError, MessageText, BufferLength, TextLength);
+ }
+ }
+ else if (HandleType == SQL_HANDLE_STMT)
+ {
+ struct SQLHSTMT_data *statement = Handle;
+
+ if (statement->connection->pSQLGetDiagRecW)
+ {
+ ret = statement->connection->pSQLGetDiagRecW(HandleType, statement->driver_stmt, RecNumber,
+ Sqlstate, NativeError, MessageText, BufferLength, TextLength);
+ }
+ else if (statement->connection->pSQLErrorW)
+ {
+ ret = statement->connection->pSQLErrorW(SQL_NULL_HENV, SQL_NULL_HDBC, statement->driver_stmt,
+ Sqlstate, NativeError, MessageText, BufferLength, TextLength);
+ }
+ }
+
+ if (ret != SQL_ERROR)
+ {
+ TRACE("%d: %s %s\n", RecNumber, debugstr_w(Sqlstate), debugstr_w(MessageText));
+ }
+
return ret;
}
--
2.43.0

View File

@ -1,61 +0,0 @@
From 14e00b2574f64b47ee25028cc59476949db6cf84 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Wed, 8 Feb 2023 08:39:26 +1100
Subject: [PATCH] odbc32: SQLGetEnvAttr: Support SQL_ATTR_ODBC_VERSION
attribute
---
dlls/odbc32/proxyodbc.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
index b8c2eb43055..cf3455c45b4 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -47,6 +47,7 @@ struct SQLHENV_data
{
int type;
SQLUINTEGER pooling;
+ SQLUINTEGER version;
};
struct SQLHDBC_data
@@ -359,6 +360,7 @@ SQLRETURN WINAPI SQLAllocEnv(SQLHENV *EnvironmentHandle)
henv->type = SQL_HANDLE_ENV;
henv->pooling = SQL_CP_OFF;
+ henv->version = SQL_OV_ODBC2;
*EnvironmentHandle = henv;
@@ -1074,6 +1076,14 @@ SQLRETURN WINAPI SQLGetEnvAttr(SQLHENV EnvironmentHandle, SQLINTEGER Attribute,
}
*(SQLUINTEGER*)Value = data->pooling;
break;
+ case SQL_ATTR_ODBC_VERSION:
+ if (BufferLength != sizeof(data->version))
+ {
+ WARN("Invalid buffer size\n");
+ return SQL_ERROR;
+ }
+ *(SQLUINTEGER*)Value = data->version;
+ break;
default:
FIXME("Unhandle attribute %d\n", Attribute);
return SQL_ERROR;
@@ -1463,6 +1473,12 @@ SQLRETURN WINAPI SQLSetEnvAttr(SQLHENV EnvironmentHandle, SQLINTEGER Attribute,
else
data->pooling = SQL_CP_OFF;
break;
+ case SQL_ATTR_ODBC_VERSION:
+ if (Value)
+ data->version = (uintptr_t)Value;
+ else
+ data->version = SQL_OV_ODBC2;
+ break;
default:
FIXME("Unhandle attribute %d\n", Attribute);
return SQL_ERROR;
--
2.43.0

View File

@ -1,33 +0,0 @@
From 014cadef9d41657c315f140daa0cbed19d43f02a 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
---
dlls/odbc32/proxyodbc.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
index cf3455c45b4..6e02d37548c 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -2654,11 +2654,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);
}
/* ODBC 2.x */
else if(connection->pSQLAllocConnect && connection->pSQLAllocEnv)
--
2.43.0

View File

@ -1,37 +0,0 @@
From c9f90dfeff20eb7faa55bdc00add8f4d18fbb1b5 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Wed, 8 Feb 2023 14:16:24 +1100
Subject: [PATCH] odbc32: SQLBindCol convert to ODBC2 types if required
---
dlls/odbc32/proxyodbc.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
index 6e02d37548c..d760481fa9b 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -465,6 +465,20 @@ SQLRETURN WINAPI SQLBindCol(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber,
if (statement->connection->pSQLBindCol)
{
+ /*
+ * Map ODBC3 Datatype back to ODBC2 types when the application has asked for SQL_OV_ODBC2.
+ * Some drivers rely on this (PostgreSQL odbc driver).
+ */
+ if (statement->connection->environment->version == SQL_OV_ODBC2)
+ {
+ 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->pSQLBindCol(statement->driver_stmt, ColumnNumber, TargetType,
TargetValue, BufferLength, StrLen_or_Ind);
}
--
2.43.0

View File

@ -1,40 +0,0 @@
From 0a67d651b40335e9b8ee09e47c8f54845101c6f7 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Wed, 8 Feb 2023 15:22:00 +1100
Subject: [PATCH] odbc32: Implement SQLAllocHandle
---
dlls/odbc32/proxyodbc.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
index d760481fa9b..879808add00 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -374,9 +374,22 @@ SQLRETURN WINAPI SQLAllocHandle(SQLSMALLINT HandleType, SQLHANDLE InputHandle, S
{
SQLRETURN ret = SQL_ERROR;
- FIXME("(HandleType %d, InputHandle %p, OutputHandle %p)\n", HandleType, InputHandle, OutputHandle);
+ TRACE("(HandleType %d, InputHandle %p, OutputHandle %p)\n", HandleType, InputHandle, OutputHandle);
*OutputHandle = 0;
+ if (HandleType == SQL_HANDLE_ENV)
+ {
+ ret = SQLAllocEnv(OutputHandle);
+ }
+ else if (HandleType == SQL_HANDLE_DBC)
+ {
+ ret = SQLAllocConnect(InputHandle, OutputHandle);
+ }
+ else if (HandleType == SQL_HANDLE_STMT)
+ {
+ ret = SQLAllocStmt(InputHandle, OutputHandle);
+ }
+
return ret;
}
--
2.43.0

View File

@ -1,48 +0,0 @@
From bbad2699c06c230f2fddecfc4a8159b763e6d233 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Wed, 8 Feb 2023 15:34:18 +1100
Subject: [PATCH] odbc32: Forward SQLConnectW request onto driver
---
dlls/odbc32/proxyodbc.c | 22 +++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
index 879808add00..89ebf0e5141 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -2131,12 +2131,28 @@ SQLRETURN WINAPI SQLConnectW(SQLHDBC ConnectionHandle, WCHAR *ServerName, SQLSMA
WCHAR *UserName, SQLSMALLINT NameLength2, WCHAR *Authentication,
SQLSMALLINT NameLength3)
{
+ struct SQLHDBC_data *connection = ConnectionHandle;
SQLRETURN ret = SQL_ERROR;
- FIXME("(ConnectionHandle %p, ServerName %s, NameLength1 %d, UserName %s, NameLength2 %d, Authentication %s,"
- " NameLength3 %d)\n", ConnectionHandle, debugstr_wn(ServerName, NameLength1), NameLength1,
- debugstr_wn(UserName, NameLength2), NameLength2, debugstr_wn(Authentication, NameLength3), NameLength3);
+ TRACE("(ConnectionHandle %p, ServerName %s, NameLength1 %d, UserName %s, NameLength2 %d, Authentication %s,"
+ " NameLength3 %d)\n", ConnectionHandle,
+ NameLength1 > 0 ? debugstr_wn(ServerName, NameLength1) : debugstr_w(ServerName), NameLength1,
+ NameLength2 > 0 ? debugstr_wn(UserName, NameLength2) : debugstr_w(UserName), NameLength2,
+ NameLength3 > 0 ? debugstr_wn(Authentication, NameLength3) : debugstr_w(Authentication), NameLength3);
+ if (!connection || connection->type != SQL_HANDLE_DBC)
+ {
+ WARN("Wrong handle type %d\n", connection ? connection->type : 0);
+ return SQL_ERROR;
+ }
+
+ if (connection->pSQLConnectW)
+ {
+ ret = connection->pSQLConnectW(connection->driver_hdbc, ServerName, NameLength1,
+ UserName, NameLength2, Authentication, NameLength3);
+ }
+
+ TRACE("ret %d\n", ret);
return ret;
}
--
2.43.0

View File

@ -1,173 +0,0 @@
From 46c661c38a41172cd11430bfa266f7e0cddf1f8d 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 | 119 ++++++++++++++++++++++++++++++++++------
1 file changed, 102 insertions(+), 17 deletions(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
index 89ebf0e5141..409bc428230 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -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)
{
+ struct SQLHSTMT_data *statement = StatementHandle;
SQLRETURN ret = SQL_ERROR;
- FIXME("(StatementHandle %p, ColumnNumber %d, FieldIdentifier %d, CharacterAttribute %p, BufferLength %d,"
+ TRACE("(StatementHandle %p, ColumnNumber %d, FieldIdentifier %d, CharacterAttribute %p, BufferLength %d,"
" StringLength %p, NumericAttribute %p)\n", StatementHandle, ColumnNumber, FieldIdentifier,
CharacterAttribute, BufferLength, StringLength, NumericAttribute);
+ if (statement->type != SQL_HANDLE_STMT)
+ {
+ WARN("Wrong handle type %d\n", statement->type);
+ 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;
}
@@ -2073,21 +2138,6 @@ SQLRETURN WINAPI SQLSetScrollOptions(SQLHSTMT statement_handle, SQLUSMALLINT f_c
return ret;
}
-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]
*/
@@ -2294,12 +2344,47 @@ SQLRETURN WINAPI SQLColAttributeW(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnN
SQLSMALLINT BufferLength, SQLSMALLINT *StringLength,
SQLLEN *NumericAttribute)
{
+ struct SQLHSTMT_data *statement = StatementHandle;
SQLRETURN ret = SQL_ERROR;
- FIXME("StatementHandle %p ColumnNumber %d FieldIdentifier %d CharacterAttribute %p BufferLength %d"
+ TRACE("StatementHandle %p ColumnNumber %d FieldIdentifier %d CharacterAttribute %p BufferLength %d"
" StringLength %p NumericAttribute %p\n", StatementHandle, ColumnNumber, FieldIdentifier,
CharacterAttribute, BufferLength, StringLength, NumericAttribute);
+ if (statement->type != SQL_HANDLE_STMT)
+ {
+ WARN("Wrong handle type %d\n", statement->type);
+ 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);
return ret;
}
--
2.43.0

View File

@ -1,59 +0,0 @@
From 8e284b4208c85a42e4aa1723876aaba208cea3d3 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 | 34 +++++++++++++++++++++++++++++++++-
1 file changed, 33 insertions(+), 1 deletion(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
index 409bc428230..25e9d5651cd 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -3201,9 +3201,41 @@ 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->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;
}
--
2.43.0

View File

@ -1,46 +0,0 @@
From 0bf2bde719089038889e6001991eaacc93718daa Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
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 25e9d5651cd..b3e4ebfe450 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -3062,14 +3062,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.43.0

View File

@ -1,48 +0,0 @@
From 4d2d26b889f8ce32d774df667625401eceb9b694 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
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 b3e4ebfe450..35ddd14e49f 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -2926,13 +2926,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;
}
--
2.43.0

View File

@ -1,60 +0,0 @@
From d417f9fe271eb9b84e0afb9fd1a9c3950f1fb9b0 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Mon, 10 Jun 2024 08:40:09 +1000
Subject: [PATCH] odbc32: Forward SQLError/W onto driver
---
dlls/odbc32/proxyodbc.c | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
index 35ddd14e49f..ce2a74310bb 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -787,12 +787,20 @@ SQLRETURN WINAPI SQLError(SQLHENV EnvironmentHandle, SQLHDBC ConnectionHandle, S
SQLCHAR *Sqlstate, SQLINTEGER *NativeError, SQLCHAR *MessageText,
SQLSMALLINT BufferLength, SQLSMALLINT *TextLength)
{
+ struct SQLHDBC_data *hdbc = ConnectionHandle;
SQLRETURN ret = SQL_ERROR;
- FIXME("(EnvironmentHandle %p, ConnectionHandle %p, StatementHandle %p, Sqlstate %p, NativeError %p,"
+ TRACE("(EnvironmentHandle %p, ConnectionHandle %p, StatementHandle %p, Sqlstate %p, NativeError %p,"
" MessageText %p, BufferLength %d, TextLength %p)\n", EnvironmentHandle, ConnectionHandle,
StatementHandle, Sqlstate, NativeError, MessageText, BufferLength, TextLength);
+ if (hdbc->pSQLError)
+ {
+ ret = hdbc->pSQLError(hdbc->driver_env, hdbc->driver_hdbc, StatementHandle, Sqlstate,
+ NativeError, MessageText, BufferLength, TextLength);
+ }
+
+ TRACE("ret %d\n", ret);
return ret;
}
@@ -2246,12 +2254,20 @@ SQLRETURN WINAPI SQLErrorW(SQLHENV EnvironmentHandle, SQLHDBC ConnectionHandle,
WCHAR *Sqlstate, SQLINTEGER *NativeError, WCHAR *MessageText,
SQLSMALLINT BufferLength, SQLSMALLINT *TextLength)
{
+ struct SQLHDBC_data *hdbc = ConnectionHandle;
SQLRETURN ret = SQL_ERROR;
- FIXME("(EnvironmentHandle %p, ConnectionHandle %p, StatementHandle %p, Sqlstate %p, NativeError %p,"
+ TRACE("(EnvironmentHandle %p, ConnectionHandle %p, StatementHandle %p, Sqlstate %p, NativeError %p,"
" MessageText %p, BufferLength %d, TextLength %p)\n", EnvironmentHandle, ConnectionHandle,
StatementHandle, Sqlstate, NativeError, MessageText, BufferLength, TextLength);
+ if (hdbc->pSQLErrorW)
+ {
+ ret = hdbc->pSQLErrorW(hdbc->driver_env, hdbc->driver_hdbc, StatementHandle, Sqlstate,
+ NativeError, MessageText, BufferLength, TextLength);
+ }
+
+ TRACE("ret %d\n", ret);
return ret;
}
--
2.43.0

View File

@ -1,64 +0,0 @@
From 506812cfd989ab515dd0c0fd11bc64dc4cdcdae7 Mon Sep 17 00:00:00 2001
From: Steve Fawcett <steve.fawcett@bitnosis.com>
Date: Wed, 12 Jun 2024 09:27:31 +1000
Subject: [PATCH] odbc32: Implement SQLFreeHandle
---
dlls/odbc32/proxyodbc.c | 40 +++++++++++++++++++++++++++++++++++++++-
1 file changed, 39 insertions(+), 1 deletion(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
index ce2a74310bb..a49fb0e82b9 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -929,8 +929,46 @@ SQLRETURN WINAPI SQLFreeHandle(SQLSMALLINT HandleType, SQLHANDLE Handle)
{
SQLRETURN ret = SQL_ERROR;
- FIXME("(HandleType %d, Handle %p)\n", HandleType, Handle);
+ TRACE("HandleType %d, Handle %p\n", HandleType, Handle);
+ if (HandleType == SQL_HANDLE_ENV)
+ {
+ struct SQLHENV_data *henv = Handle;
+
+ if (henv && henv->type != SQL_HANDLE_ENV)
+ WARN("EnvironmentHandle isn't of type SQL_HANDLE_ENV\n");
+ else {
+ henv->type = 0;
+ free(henv);
+ ret = SQL_SUCCESS;
+ }
+ }
+ else if (HandleType == SQL_HANDLE_DBC)
+ {
+ struct SQLHDBC_data *hdbc = Handle;
+
+ if (hdbc->pSQLFreeHandle)
+ ret = hdbc->pSQLFreeHandle(HandleType, hdbc->driver_hdbc);
+ else if (hdbc->pSQLFreeConnect)
+ ret = hdbc->pSQLFreeConnect(hdbc->driver_hdbc);
+
+ hdbc->type = 0;
+ free(hdbc);
+ }
+ else if (HandleType == SQL_HANDLE_STMT)
+ {
+ struct SQLHSTMT_data *statement = Handle;
+
+ if (statement->connection->pSQLFreeHandle)
+ ret = statement->connection->pSQLFreeHandle(HandleType, statement->driver_stmt);
+ else if (statement->connection->pSQLFreeStmt)
+ ret = statement->connection->pSQLFreeStmt(statement->driver_stmt, SQL_CLOSE);
+
+ statement->type = 0;
+ free(statement);
+ }
+
+ TRACE("ret %d\n", ret);
return ret;
}
--
2.43.0

View File

@ -1,2 +0,0 @@
Fixes: [54499] Support native ODBC drivers.
Disabled: True