mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-09-13 09:17:20 -07:00
Added odbc32-fixes patchset
This fixes issue with the current odcb32 for writing to database and support for ODBC v2.0. This is a replacement for odbc-remove-unixodbc as ODBC32 now supports both unixODBC and native drivers.
This commit is contained in:
parent
12fb6d73ff
commit
ad13b6a9e1
@ -0,0 +1,46 @@
|
||||
From 45cc0ee874528258d34e21063cf514ccf40a9865 Mon Sep 17 00:00:00 2001
|
||||
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
||||
Date: Fri, 12 Jul 2024 13:42:26 +1000
|
||||
Subject: [PATCH] odbc32: SQLFreeHandle handle ODBC v2 drivers
|
||||
|
||||
---
|
||||
dlls/odbc32/proxyodbc.c | 23 ++++++++++++++++++++++-
|
||||
1 file changed, 22 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
|
||||
index 957584af008..9a4f08440ea 100644
|
||||
--- a/dlls/odbc32/proxyodbc.c
|
||||
+++ b/dlls/odbc32/proxyodbc.c
|
||||
@@ -1454,7 +1454,28 @@ SQLRETURN WINAPI SQLFreeHandle(SQLSMALLINT HandleType, SQLHANDLE Handle)
|
||||
}
|
||||
else if (handle->win32_handle)
|
||||
{
|
||||
- ret = handle->win32_funcs->SQLFreeHandle( HandleType, handle->win32_handle );
|
||||
+ if (handle->win32_funcs->SQLFreeHandle)
|
||||
+ {
|
||||
+ ret = handle->win32_funcs->SQLFreeHandle( HandleType, handle->win32_handle );
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ /* ODBC v2 */
|
||||
+ if (HandleType == SQL_HANDLE_DBC)
|
||||
+ {
|
||||
+ if (handle->win32_funcs->SQLFreeConnect)
|
||||
+ ret = handle->win32_funcs->SQLFreeConnect(handle->win32_handle);
|
||||
+ else
|
||||
+ ERR("Failed to free connection HANDLE\n");
|
||||
+ }
|
||||
+ else if (HandleType == SQL_HANDLE_STMT)
|
||||
+ {
|
||||
+ if (handle->win32_funcs->SQLFreeStmt)
|
||||
+ ret = handle->win32_funcs->SQLFreeStmt(handle->win32_handle, SQL_CLOSE);
|
||||
+ else
|
||||
+ ERR("Failed to free statement HANDLE\n");
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
|
||||
RegCloseKey( handle->drivers_key );
|
||||
--
|
||||
2.43.0
|
||||
|
@ -0,0 +1,230 @@
|
||||
From 9a04cd1f7199385e7521fd77f1118682e50192cf Mon Sep 17 00:00:00 2001
|
||||
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
||||
Date: Fri, 12 Jul 2024 14:13:33 +1000
|
||||
Subject: [PATCH] odbc32: Support Driver in connection string
|
||||
|
||||
---
|
||||
dlls/odbc32/proxyodbc.c | 97 +++++++++++++++++++++++++++++++----------
|
||||
1 file changed, 74 insertions(+), 23 deletions(-)
|
||||
|
||||
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
|
||||
index 9a4f08440ea..c19d401168b 100644
|
||||
--- a/dlls/odbc32/proxyodbc.c
|
||||
+++ b/dlls/odbc32/proxyodbc.c
|
||||
@@ -753,11 +753,20 @@ static WCHAR *strdupAW( const char *src )
|
||||
return dst;
|
||||
}
|
||||
|
||||
-static HKEY open_odbcini_key( HKEY root )
|
||||
+static HKEY open_odbcini_key( HKEY root, BOOL use_dsn )
|
||||
{
|
||||
static const WCHAR sourcesW[] = L"Software\\ODBC\\ODBC.INI";
|
||||
+ static const WCHAR driversW[] = L"Software\\ODBC\\ODBCINST.INI";
|
||||
HKEY key;
|
||||
- if (!RegCreateKeyExW( root, sourcesW, 0, NULL, 0, KEY_ALL_ACCESS, NULL, &key, NULL )) return key;
|
||||
+
|
||||
+ if (use_dsn)
|
||||
+ {
|
||||
+ if (!RegCreateKeyExW( root, sourcesW, 0, NULL, 0, KEY_ALL_ACCESS, NULL, &key, NULL )) return key;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ if (!RegCreateKeyExW( root, driversW, 0, NULL, 0, KEY_ALL_ACCESS, NULL, &key, NULL )) return key;
|
||||
+ }
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -771,12 +780,12 @@ static WCHAR *get_reg_value( HKEY key, const WCHAR *name )
|
||||
return NULL;
|
||||
}
|
||||
|
||||
-static WCHAR *get_driver_filename( const SQLWCHAR *source )
|
||||
+static WCHAR *get_driver_filename( const SQLWCHAR *source, BOOL use_dsn )
|
||||
{
|
||||
HKEY key_root, key_source;
|
||||
WCHAR *ret = NULL;
|
||||
|
||||
- if (!(key_root = open_odbcini_key( HKEY_CURRENT_USER ))) return NULL;
|
||||
+ if (!(key_root = open_odbcini_key( HKEY_CURRENT_USER, use_dsn ))) return NULL;
|
||||
if (!RegOpenKeyExW( key_root, source, 0, KEY_READ, &key_source ))
|
||||
{
|
||||
ret = get_reg_value( key_source, L"Driver" );
|
||||
@@ -785,7 +794,7 @@ static WCHAR *get_driver_filename( const SQLWCHAR *source )
|
||||
RegCloseKey( key_root );
|
||||
if (ret) return ret;
|
||||
|
||||
- if (!(key_root = open_odbcini_key( HKEY_LOCAL_MACHINE ))) return NULL;
|
||||
+ if (!(key_root = open_odbcini_key( HKEY_LOCAL_MACHINE, use_dsn ))) return NULL;
|
||||
if (!RegOpenKeyExW( key_root, source, 0, KEY_READ, &key_source ))
|
||||
{
|
||||
ret = get_reg_value( key_source, L"Driver" );
|
||||
@@ -919,7 +928,7 @@ SQLRETURN WINAPI SQLConnect(SQLHDBC ConnectionHandle, SQLCHAR *ServerName, SQLSM
|
||||
|
||||
if (!handle) return SQL_INVALID_HANDLE;
|
||||
|
||||
- if (!servername || !(filename = get_driver_filename( servername )))
|
||||
+ if (!servername || !(filename = get_driver_filename( servername, TRUE )))
|
||||
{
|
||||
WARN( "can't find driver filename\n" );
|
||||
goto done;
|
||||
@@ -2650,6 +2659,32 @@ static WCHAR *get_datasource( const WCHAR *connection_string )
|
||||
return ret;
|
||||
}
|
||||
|
||||
+static WCHAR *get_driver( const WCHAR *connection_string )
|
||||
+{
|
||||
+ const WCHAR *p = connection_string, *q;
|
||||
+ WCHAR *ret = NULL;
|
||||
+ unsigned int len;
|
||||
+
|
||||
+ if (!p) return NULL;
|
||||
+ while (*p)
|
||||
+ {
|
||||
+ if (!wcsnicmp( p, L"DRIVER=", 7 ))
|
||||
+ {
|
||||
+ p += 7;
|
||||
+ q = wcschr( p, ';' );
|
||||
+ len = q ? (q - p) : wcslen( p );
|
||||
+ if ((ret = malloc( (len + 1) * sizeof(WCHAR) )))
|
||||
+ {
|
||||
+ memcpy( ret, p, len * sizeof(WCHAR) );
|
||||
+ ret[len] = 0;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ p++;
|
||||
+ }
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
/*************************************************************************
|
||||
* SQLBrowseConnect [ODBC32.055]
|
||||
*/
|
||||
@@ -2659,6 +2694,7 @@ SQLRETURN WINAPI SQLBrowseConnect(SQLHDBC ConnectionHandle, SQLCHAR *InConnectio
|
||||
struct handle *handle = ConnectionHandle;
|
||||
WCHAR *datasource = NULL, *filename = NULL, *connection_string = strdupAW( (const char *)InConnectionString );
|
||||
SQLRETURN ret = SQL_ERROR;
|
||||
+ BOOL use_dsn = TRUE;
|
||||
|
||||
TRACE("(ConnectionHandle %p, InConnectionString %s, StringLength1 %d, OutConnectionString %p, BufferLength, %d, "
|
||||
"StringLength2 %p)\n", ConnectionHandle, debugstr_an((const char *)InConnectionString, StringLength1),
|
||||
@@ -2666,13 +2702,16 @@ SQLRETURN WINAPI SQLBrowseConnect(SQLHDBC ConnectionHandle, SQLCHAR *InConnectio
|
||||
|
||||
if (!handle) return SQL_INVALID_HANDLE;
|
||||
|
||||
- /* FIXME: try DRIVER attribute if DSN is absent */
|
||||
if (!connection_string || !(datasource = get_datasource( connection_string )))
|
||||
{
|
||||
- WARN( "can't find data source\n" );
|
||||
- goto done;
|
||||
+ use_dsn = FALSE;
|
||||
+ if (!(datasource = get_driver( connection_string )))
|
||||
+ {
|
||||
+ WARN( "can't find data source\n" );
|
||||
+ goto done;
|
||||
+ }
|
||||
}
|
||||
- if (!(filename = get_driver_filename( datasource )))
|
||||
+ if (!(filename = get_driver_filename( datasource, use_dsn )))
|
||||
{
|
||||
WARN( "can't find driver filename\n" );
|
||||
goto done;
|
||||
@@ -3319,6 +3358,7 @@ SQLRETURN WINAPI SQLDriverConnect(SQLHDBC ConnectionHandle, SQLHWND WindowHandle
|
||||
struct handle *handle = ConnectionHandle;
|
||||
WCHAR *datasource = NULL, *filename = NULL, *connection_string = strdupAW( (const char *)InConnectionString );
|
||||
SQLRETURN ret = SQL_ERROR;
|
||||
+ BOOL use_dsn = TRUE;
|
||||
|
||||
TRACE("(ConnectionHandle %p, WindowHandle %p, InConnectionString %s, Length %d, OutConnectionString, %p,"
|
||||
" BufferLength, %d, Length2 %p, DriverCompletion %d)\n", ConnectionHandle, WindowHandle,
|
||||
@@ -3327,13 +3367,16 @@ SQLRETURN WINAPI SQLDriverConnect(SQLHDBC ConnectionHandle, SQLHWND WindowHandle
|
||||
|
||||
if (!handle) return SQL_INVALID_HANDLE;
|
||||
|
||||
- /* FIXME: try DRIVER attribute if DSN is absent */
|
||||
if (!connection_string || !(datasource = get_datasource( connection_string )))
|
||||
{
|
||||
- WARN( "can't find data source\n" );
|
||||
- goto done;
|
||||
+ use_dsn = FALSE;
|
||||
+ if (!(datasource = get_driver( connection_string )))
|
||||
+ {
|
||||
+ WARN( "can't find data source\n" );
|
||||
+ goto done;
|
||||
+ }
|
||||
}
|
||||
- if (!(filename = get_driver_filename( datasource )))
|
||||
+ if (!(filename = get_driver_filename( datasource, use_dsn )))
|
||||
{
|
||||
WARN( "can't find driver filename\n" );
|
||||
goto done;
|
||||
@@ -3490,7 +3533,7 @@ SQLRETURN WINAPI SQLConnectW(SQLHDBC ConnectionHandle, WCHAR *ServerName, SQLSMA
|
||||
|
||||
if (!handle) return SQL_INVALID_HANDLE;
|
||||
|
||||
- if (!(filename = get_driver_filename( ServerName )))
|
||||
+ if (!(filename = get_driver_filename( ServerName, TRUE )))
|
||||
{
|
||||
WARN( "can't find driver filename\n" );
|
||||
goto done;
|
||||
@@ -4056,6 +4099,7 @@ SQLRETURN WINAPI SQLDriverConnectW(SQLHDBC ConnectionHandle, SQLHWND WindowHandl
|
||||
struct handle *handle = ConnectionHandle;
|
||||
WCHAR *datasource, *filename = NULL;
|
||||
SQLRETURN ret = SQL_ERROR;
|
||||
+ BOOL use_dsn = TRUE;
|
||||
|
||||
TRACE("(ConnectionHandle %p, WindowHandle %p, InConnectionString %s, Length %d, OutConnectionString %p,"
|
||||
" BufferLength %d, Length2 %p, DriverCompletion %d)\n", ConnectionHandle, WindowHandle,
|
||||
@@ -4064,13 +4108,16 @@ SQLRETURN WINAPI SQLDriverConnectW(SQLHDBC ConnectionHandle, SQLHWND WindowHandl
|
||||
|
||||
if (!handle) return SQL_INVALID_HANDLE;
|
||||
|
||||
- /* FIXME: try DRIVER attribute if DSN is absent */
|
||||
if (!(datasource = get_datasource( InConnectionString )))
|
||||
{
|
||||
- WARN( "can't find data source\n" );
|
||||
- goto done;
|
||||
+ use_dsn = FALSE;
|
||||
+ if (!(datasource = get_driver( InConnectionString )))
|
||||
+ {
|
||||
+ WARN( "can't find data source\n" );
|
||||
+ goto done;
|
||||
+ }
|
||||
}
|
||||
- if (!(filename = get_driver_filename( datasource )))
|
||||
+ if (!(filename = get_driver_filename( datasource, use_dsn )))
|
||||
{
|
||||
WARN( "can't find driver filename\n" );
|
||||
goto done;
|
||||
@@ -4346,6 +4393,7 @@ SQLRETURN WINAPI SQLBrowseConnectW(SQLHDBC ConnectionHandle, SQLWCHAR *InConnect
|
||||
struct handle *handle = ConnectionHandle;
|
||||
WCHAR *datasource, *filename = NULL;
|
||||
SQLRETURN ret = SQL_ERROR;
|
||||
+ BOOL use_dsn = TRUE;
|
||||
|
||||
TRACE("(ConnectionHandle %p, InConnectionString %s, StringLength1 %d, OutConnectionString %p, BufferLength %d, "
|
||||
"StringLength2 %p)\n", ConnectionHandle, debugstr_wn(InConnectionString, StringLength1), StringLength1,
|
||||
@@ -4353,13 +4401,16 @@ SQLRETURN WINAPI SQLBrowseConnectW(SQLHDBC ConnectionHandle, SQLWCHAR *InConnect
|
||||
|
||||
if (!handle) return SQL_INVALID_HANDLE;
|
||||
|
||||
- /* FIXME: try DRIVER attribute if DSN is absent */
|
||||
if (!(datasource = get_datasource( InConnectionString )))
|
||||
{
|
||||
- WARN( "can't find data source\n" );
|
||||
- goto done;
|
||||
+ use_dsn = FALSE;
|
||||
+ if (!(datasource = get_driver( InConnectionString )))
|
||||
+ {
|
||||
+ WARN( "can't find data source\n" );
|
||||
+ goto done;
|
||||
+ }
|
||||
}
|
||||
- if (!(filename = get_driver_filename( datasource )))
|
||||
+ if (!(filename = get_driver_filename( datasource, use_dsn )))
|
||||
{
|
||||
WARN( "can't find driver filename\n" );
|
||||
goto done;
|
||||
--
|
||||
2.43.0
|
||||
|
@ -0,0 +1,58 @@
|
||||
From a9f272e877306607e502a268cb232609f56eed85 Mon Sep 17 00:00:00 2001
|
||||
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
||||
Date: Fri, 12 Jul 2024 14:19:22 +1000
|
||||
Subject: [PATCH] odbc32: SQLColAttributeW support fallback function
|
||||
|
||||
---
|
||||
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 c19d401168b..3ccb331a6be 100644
|
||||
--- a/dlls/odbc32/proxyodbc.c
|
||||
+++ b/dlls/odbc32/proxyodbc.c
|
||||
@@ -3758,6 +3758,21 @@ SQLRETURN WINAPI SQLSetCursorNameW(SQLHSTMT StatementHandle, WCHAR *CursorName,
|
||||
return ret;
|
||||
}
|
||||
|
||||
+static SQLINTEGER map_odbc3_to_2(SQLINTEGER fieldid)
|
||||
+{
|
||||
+ switch( fieldid )
|
||||
+ {
|
||||
+ case SQL_DESC_COUNT:
|
||||
+ return SQL_COLUMN_COUNT;
|
||||
+ case SQL_DESC_NULLABLE:
|
||||
+ return SQL_COLUMN_NULLABLE;
|
||||
+ case SQL_DESC_NAME:
|
||||
+ return SQL_COLUMN_NAME;
|
||||
+ default:
|
||||
+ return fieldid;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
/*************************************************************************
|
||||
* SQLColAttributeW [ODBC32.127]
|
||||
*/
|
||||
@@ -3792,9 +3807,18 @@ SQLRETURN WINAPI SQLColAttributeW(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnN
|
||||
}
|
||||
else if (handle->win32_handle)
|
||||
{
|
||||
- ret = handle->win32_funcs->SQLColAttributeW( handle->win32_handle, ColumnNumber, FieldIdentifier,
|
||||
+ if (handle->win32_funcs->SQLColAttributeW)
|
||||
+ ret = handle->win32_funcs->SQLColAttributeW( handle->win32_handle, ColumnNumber, FieldIdentifier,
|
||||
CharacterAttribute, BufferLength, StringLength,
|
||||
NumericAttribute );
|
||||
+ else if(handle->win32_funcs->SQLColAttributesW)
|
||||
+ {
|
||||
+ /* ODBC v2 */
|
||||
+ FieldIdentifier = map_odbc3_to_2(FieldIdentifier);
|
||||
+ ret = handle->win32_funcs->SQLColAttributesW( handle->win32_handle, ColumnNumber, FieldIdentifier,
|
||||
+ CharacterAttribute, BufferLength, StringLength,
|
||||
+ NumericAttribute );
|
||||
+ }
|
||||
}
|
||||
|
||||
TRACE("Returning %d\n", ret);
|
||||
--
|
||||
2.43.0
|
||||
|
@ -0,0 +1,62 @@
|
||||
From fda9d9bf29a6d1a3091dc648be8702b8b2b5cd99 Mon Sep 17 00:00:00 2001
|
||||
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
||||
Date: Fri, 12 Jul 2024 14:23:01 +1000
|
||||
Subject: [PATCH] odbc32: SQLError/W handle NULL handles
|
||||
|
||||
---
|
||||
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 3ccb331a6be..31a789b26a4 100644
|
||||
--- a/dlls/odbc32/proxyodbc.c
|
||||
+++ b/dlls/odbc32/proxyodbc.c
|
||||
@@ -1191,8 +1191,19 @@ SQLRETURN WINAPI SQLError(SQLHENV EnvironmentHandle, SQLHDBC ConnectionHandle, S
|
||||
}
|
||||
else if ((env && env->win32_handle) || (con && con->win32_handle) || (stmt && stmt->win32_handle))
|
||||
{
|
||||
- ret = env->win32_funcs->SQLError( env->win32_handle, con->win32_handle, stmt->win32_handle, SqlState,
|
||||
- NativeError, MessageText, BufferLength, TextLength );
|
||||
+ const struct win32_funcs *win32_funcs = NULL;
|
||||
+
|
||||
+ if (env) win32_funcs = env->win32_funcs;
|
||||
+ else if (con) win32_funcs = con->win32_funcs;
|
||||
+ else if (stmt) win32_funcs = con->win32_funcs;
|
||||
+
|
||||
+ if(win32_funcs)
|
||||
+ ret = win32_funcs->SQLError( env ? env->win32_handle : NULL,
|
||||
+ con ? con->win32_handle : NULL,
|
||||
+ stmt ? stmt->win32_handle : NULL,
|
||||
+ SqlState, NativeError, MessageText, BufferLength, TextLength );
|
||||
+ else
|
||||
+ ERR("No function map found\n");
|
||||
}
|
||||
|
||||
if (SUCCESS( ret ))
|
||||
@@ -3633,10 +3644,19 @@ SQLRETURN WINAPI SQLErrorW(SQLHENV EnvironmentHandle, SQLHDBC ConnectionHandle,
|
||||
}
|
||||
else if ((env && env->win32_handle) || (con && con->win32_handle) || (stmt && stmt->win32_handle))
|
||||
{
|
||||
- ret = env->win32_funcs->SQLErrorW( env ? env->win32_handle : NULL,
|
||||
- con ? con->win32_handle : NULL,
|
||||
- stmt ? stmt->win32_handle : NULL,
|
||||
- SqlState, NativeError, MessageText, BufferLength, TextLength );
|
||||
+ const struct win32_funcs *win32_funcs = NULL;
|
||||
+
|
||||
+ if (env) win32_funcs = env->win32_funcs;
|
||||
+ else if (con) win32_funcs = con->win32_funcs;
|
||||
+ else if (stmt) win32_funcs = con->win32_funcs;
|
||||
+
|
||||
+ if(win32_funcs)
|
||||
+ ret = win32_funcs->SQLErrorW( env ? env->win32_handle : NULL,
|
||||
+ con ? con->win32_handle : NULL,
|
||||
+ stmt ? stmt->win32_handle : NULL,
|
||||
+ SqlState, NativeError, MessageText, BufferLength, TextLength );
|
||||
+ else
|
||||
+ ERR("No function map found\n");
|
||||
}
|
||||
|
||||
if (SUCCESS(ret ))
|
||||
--
|
||||
2.43.0
|
||||
|
@ -0,0 +1,68 @@
|
||||
From e934286dc1be469392c92cbca9d862d33edfd9e7 Mon Sep 17 00:00:00 2001
|
||||
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
||||
Date: Fri, 12 Jul 2024 14:29:17 +1000
|
||||
Subject: [PATCH] odbc32: SQLGetDiagRec/W handle fallback function
|
||||
|
||||
---
|
||||
dlls/odbc32/proxyodbc.c | 37 ++++++++++++++++++++++++++++++++++---
|
||||
1 file changed, 34 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
|
||||
index 31a789b26a4..e955c5f86f7 100644
|
||||
--- a/dlls/odbc32/proxyodbc.c
|
||||
+++ b/dlls/odbc32/proxyodbc.c
|
||||
@@ -1807,8 +1807,23 @@ SQLRETURN WINAPI SQLGetDiagRec(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMAL
|
||||
}
|
||||
else if (handle->win32_handle)
|
||||
{
|
||||
- ret = handle->win32_funcs->SQLGetDiagRec( HandleType, handle->win32_handle, RecNumber, SqlState, NativeError,
|
||||
+ if (handle->win32_funcs->SQLGetDiagRec)
|
||||
+ {
|
||||
+ ret = handle->win32_funcs->SQLGetDiagRec( HandleType, handle->win32_handle, RecNumber, SqlState, NativeError,
|
||||
MessageText, BufferLength, TextLength );
|
||||
+ }
|
||||
+ else if (handle->win32_funcs->SQLError)
|
||||
+ {
|
||||
+ if (HandleType == SQL_HANDLE_ENV)
|
||||
+ ret = handle->win32_funcs->SQLError(handle->win32_handle, SQL_NULL_HDBC, SQL_NULL_HSTMT,
|
||||
+ SqlState, NativeError, MessageText, BufferLength, TextLength);
|
||||
+ else if (HandleType == SQL_HANDLE_DBC)
|
||||
+ ret = handle->win32_funcs->SQLError(SQL_NULL_HENV, handle->win32_handle, SQL_NULL_HSTMT,
|
||||
+ SqlState, NativeError, MessageText, BufferLength, TextLength);
|
||||
+ else if (HandleType == SQL_HANDLE_STMT)
|
||||
+ ret = handle->win32_funcs->SQLError(SQL_NULL_HENV, SQL_NULL_HDBC, handle->win32_handle,
|
||||
+ SqlState, NativeError, MessageText, BufferLength, TextLength);
|
||||
+ }
|
||||
}
|
||||
|
||||
TRACE("Returning %d\n", ret);
|
||||
@@ -4012,8 +4027,24 @@ SQLRETURN WINAPI SQLGetDiagRecW(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMA
|
||||
}
|
||||
else if (handle->win32_handle)
|
||||
{
|
||||
- ret = handle->win32_funcs->SQLGetDiagRecW( HandleType, handle->win32_handle, RecNumber, SqlState, NativeError,
|
||||
- MessageText, BufferLength, TextLength );
|
||||
+ if (handle->win32_funcs->SQLGetDiagRecW)
|
||||
+ {
|
||||
+ ret = handle->win32_funcs->SQLGetDiagRecW( HandleType, handle->win32_handle, RecNumber, SqlState,
|
||||
+ NativeError, MessageText, BufferLength, TextLength );
|
||||
+ }
|
||||
+ else if (handle->win32_funcs->SQLErrorW)
|
||||
+ {
|
||||
+ /* ODBC v2 */
|
||||
+ if (HandleType == SQL_HANDLE_ENV)
|
||||
+ ret = handle->win32_funcs->SQLErrorW(handle->win32_handle, SQL_NULL_HDBC, SQL_NULL_HSTMT,
|
||||
+ SqlState, NativeError, MessageText, BufferLength, TextLength);
|
||||
+ else if (HandleType == SQL_HANDLE_DBC)
|
||||
+ ret = handle->win32_funcs->SQLErrorW(SQL_NULL_HENV, handle->win32_handle, SQL_NULL_HSTMT,
|
||||
+ SqlState, NativeError, MessageText, BufferLength, TextLength);
|
||||
+ else if (HandleType == SQL_HANDLE_STMT)
|
||||
+ ret = handle->win32_funcs->SQLErrorW(SQL_NULL_HENV, SQL_NULL_HDBC, handle->win32_handle,
|
||||
+ SqlState, NativeError, MessageText, BufferLength, TextLength);
|
||||
+ }
|
||||
}
|
||||
|
||||
TRACE("Returning %d\n", ret);
|
||||
--
|
||||
2.43.0
|
||||
|
@ -0,0 +1,32 @@
|
||||
From 55817c84c2be5c143788b820d5cdf37e7eee3199 Mon Sep 17 00:00:00 2001
|
||||
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
||||
Date: Fri, 12 Jul 2024 14:44:43 +1000
|
||||
Subject: [PATCH] odbc32: Load function pointer for SQLBindParam
|
||||
|
||||
---
|
||||
dlls/odbc32/proxyodbc.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
|
||||
index e955c5f86f7..d218efb9545 100644
|
||||
--- a/dlls/odbc32/proxyodbc.c
|
||||
+++ b/dlls/odbc32/proxyodbc.c
|
||||
@@ -50,6 +50,7 @@ struct win32_funcs
|
||||
SQLRETURN WINAPI (*SQLAllocHandleStd)(SQLSMALLINT,SQLHANDLE,SQLHANDLE*);
|
||||
SQLRETURN WINAPI (*SQLAllocStmt)(SQLHDBC,SQLHSTMT*);
|
||||
SQLRETURN WINAPI (*SQLBindCol)(SQLHSTMT,SQLUSMALLINT,SQLSMALLINT,SQLPOINTER,SQLLEN,SQLLEN*);
|
||||
+ SQLRETURN WINAPI (*SQLBindParam)(SQLHSTMT,SQLUSMALLINT,SQLSMALLINT,SQLSMALLINT,SQLULEN,SQLSMALLINT,SQLPOINTER,SQLLEN*);
|
||||
SQLRETURN WINAPI (*SQLBindParameter)(SQLHSTMT,SQLUSMALLINT,SQLSMALLINT,SQLSMALLINT,SQLSMALLINT,SQLULEN,
|
||||
SQLSMALLINT,SQLPOINTER,SQLLEN,SQLLEN*);
|
||||
SQLRETURN WINAPI (*SQLBrowseConnect)(SQLHDBC,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT,SQLSMALLINT*);
|
||||
@@ -206,6 +207,7 @@ static BOOL load_function_table( HMODULE module, struct win32_driver *driver )
|
||||
LOAD_FUNCPTR( SQLAllocHandleStd )
|
||||
LOAD_FUNCPTR( SQLAllocStmt )
|
||||
LOAD_FUNCPTR( SQLBindCol )
|
||||
+ LOAD_FUNCPTR( SQLBindParam )
|
||||
LOAD_FUNCPTR( SQLBindParameter )
|
||||
LOAD_FUNCPTR( SQLBrowseConnect )
|
||||
LOAD_FUNCPTR( SQLBrowseConnectW )
|
||||
--
|
||||
2.43.0
|
||||
|
@ -0,0 +1,52 @@
|
||||
From eb9fa655f1a1a6f209763e13ba7ee192cdc59be3 Mon Sep 17 00:00:00 2001
|
||||
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
||||
Date: Fri, 12 Jul 2024 14:40:32 +1000
|
||||
Subject: [PATCH] odbc32: SQLBindParameter handle fallback function
|
||||
|
||||
---
|
||||
dlls/odbc32/proxyodbc.c | 27 ++++++++++++++++++++++++++-
|
||||
1 file changed, 26 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
|
||||
index d218efb9545..11fcbe97be8 100644
|
||||
--- a/dlls/odbc32/proxyodbc.c
|
||||
+++ b/dlls/odbc32/proxyodbc.c
|
||||
@@ -3367,9 +3367,34 @@ SQLRETURN WINAPI SQLBindParameter(SQLHSTMT StatementHandle, SQLUSMALLINT Paramet
|
||||
}
|
||||
else if (handle->win32_handle)
|
||||
{
|
||||
- ret = handle->win32_funcs->SQLBindParameter( handle->win32_handle, ParameterNumber, InputOutputType, ValueType,
|
||||
+ if (handle->win32_funcs->SQLBindParameter)
|
||||
+ {
|
||||
+ ret = handle->win32_funcs->SQLBindParameter( handle->win32_handle, ParameterNumber, InputOutputType, ValueType,
|
||||
ParameterType, ColumnSize, DecimalDigits, ParameterValue,
|
||||
BufferLength, StrLen_or_Ind );
|
||||
+ }
|
||||
+ else if(handle->win32_funcs->SQLBindParam)
|
||||
+ {
|
||||
+ /* ODBC v2 */
|
||||
+ /* TODO: Make function */
|
||||
+ if(ValueType == SQL_C_TYPE_TIME)
|
||||
+ ValueType = SQL_C_TIME;
|
||||
+ else if(ValueType == SQL_C_TYPE_DATE)
|
||||
+ ValueType = SQL_C_DATE;
|
||||
+ else if(ValueType == SQL_C_TYPE_TIMESTAMP)
|
||||
+ ValueType = SQL_C_TIMESTAMP;
|
||||
+
|
||||
+ /* TODO: Make function */
|
||||
+ if (ParameterType == SQL_TIME)
|
||||
+ ParameterType = SQL_TYPE_TIME;
|
||||
+ else if (ParameterType == SQL_DATE)
|
||||
+ ParameterType = SQL_TYPE_DATE;
|
||||
+ else if (ParameterType == SQL_TIMESTAMP)
|
||||
+ ParameterType = SQL_TYPE_TIMESTAMP;;;
|
||||
+
|
||||
+ ret = handle->win32_funcs->SQLBindParam(handle->win32_handle, ParameterNumber, ValueType, ParameterType,
|
||||
+ ColumnSize, DecimalDigits, ParameterValue, StrLen_or_Ind);
|
||||
+ }
|
||||
}
|
||||
|
||||
TRACE("Returning %d\n", ret);
|
||||
--
|
||||
2.43.0
|
||||
|
@ -0,0 +1,46 @@
|
||||
From 2834d453dab7a66f3d16bada6c295a828d14d4f0 Mon Sep 17 00:00:00 2001
|
||||
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
||||
Date: Fri, 12 Jul 2024 14:55:47 +1000
|
||||
Subject: [PATCH] odbc32: SQLSetConnectAttr/W handle fallback function
|
||||
|
||||
---
|
||||
dlls/odbc32/proxyodbc.c | 16 ++++++++++++++--
|
||||
1 file changed, 14 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
|
||||
index 11fcbe97be8..1c92560d7ee 100644
|
||||
--- a/dlls/odbc32/proxyodbc.c
|
||||
+++ b/dlls/odbc32/proxyodbc.c
|
||||
@@ -2194,7 +2194,13 @@ SQLRETURN WINAPI SQLSetConnectAttr(SQLHDBC ConnectionHandle, SQLINTEGER Attribut
|
||||
}
|
||||
else if (handle->win32_handle)
|
||||
{
|
||||
- ret = handle->win32_funcs->SQLSetConnectAttr( handle->win32_handle, Attribute, Value, StringLength );
|
||||
+ if(handle->win32_funcs->SQLSetConnectOption)
|
||||
+ ret = handle->win32_funcs->SQLSetConnectAttr( handle->win32_handle, Attribute, Value, StringLength );
|
||||
+ else if(handle->win32_funcs->SQLSetConnectOption)
|
||||
+ {
|
||||
+ /* ODBC v2 */
|
||||
+ ret = handle->win32_funcs->SQLSetConnectOption( handle->win32_handle, Attribute, (SQLULEN)Value );
|
||||
+ }
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -4133,7 +4139,13 @@ SQLRETURN WINAPI SQLSetConnectAttrW(SQLHDBC ConnectionHandle, SQLINTEGER Attribu
|
||||
}
|
||||
else if (handle->win32_handle)
|
||||
{
|
||||
- ret = handle->win32_funcs->SQLSetConnectAttrW( handle->win32_handle, Attribute, Value, StringLength );
|
||||
+ if (handle->win32_funcs->SQLSetConnectAttrW)
|
||||
+ ret = handle->win32_funcs->SQLSetConnectAttrW( handle->win32_handle, Attribute, Value, StringLength );
|
||||
+ else if(handle->win32_funcs->SQLSetConnectOptionW)
|
||||
+ {
|
||||
+ /* ODBC v2 */
|
||||
+ ret = handle->win32_funcs->SQLSetConnectOptionW( handle->win32_handle, Attribute, (SQLULEN)Value );
|
||||
+ }
|
||||
}
|
||||
else
|
||||
{
|
||||
--
|
||||
2.43.0
|
||||
|
@ -0,0 +1,28 @@
|
||||
From 530ff70a5850037732caf2d49954d09bb309f9b9 Mon Sep 17 00:00:00 2001
|
||||
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
||||
Date: Sat, 13 Jul 2024 14:43:47 +1000
|
||||
Subject: [PATCH] odbc32: SQLSetEnvAttr fake success for
|
||||
SQL_ATTR_CONNECTION_POOLING
|
||||
|
||||
---
|
||||
dlls/odbc32/proxyodbc.c | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
|
||||
index 1c92560d7ee..125979a5a15 100644
|
||||
--- a/dlls/odbc32/proxyodbc.c
|
||||
+++ b/dlls/odbc32/proxyodbc.c
|
||||
@@ -2374,6 +2374,10 @@ SQLRETURN WINAPI SQLSetEnvAttr(SQLHENV EnvironmentHandle, SQLINTEGER Attribute,
|
||||
handle->env_attr_version = (UINT32)(ULONG_PTR)Value;
|
||||
break;
|
||||
|
||||
+ case SQL_ATTR_CONNECTION_POOLING:
|
||||
+ FIXME("Ignore Pooling value\n");
|
||||
+ break;
|
||||
+
|
||||
default:
|
||||
FIXME( "unhandled attribute %d\n", Attribute );
|
||||
ret = SQL_ERROR;
|
||||
--
|
||||
2.43.0
|
||||
|
@ -0,0 +1,25 @@
|
||||
From e682ace7303d8b2b60e6cc3a578805c1d9e4a18e Mon Sep 17 00:00:00 2001
|
||||
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
||||
Date: Sat, 13 Jul 2024 15:11:49 +1000
|
||||
Subject: [PATCH] odbc32: SQLSetConnectAttrW correct default return value
|
||||
|
||||
---
|
||||
dlls/odbc32/proxyodbc.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
|
||||
index 125979a5a15..550e7b16be4 100644
|
||||
--- a/dlls/odbc32/proxyodbc.c
|
||||
+++ b/dlls/odbc32/proxyodbc.c
|
||||
@@ -4129,7 +4129,7 @@ SQLRETURN WINAPI SQLSetConnectAttrW(SQLHDBC ConnectionHandle, SQLINTEGER Attribu
|
||||
SQLINTEGER StringLength)
|
||||
{
|
||||
struct handle *handle = ConnectionHandle;
|
||||
- SQLRETURN ret = SQL_ERROR;
|
||||
+ SQLRETURN ret = SQL_SUCCESS;
|
||||
|
||||
TRACE("(ConnectionHandle %p, Attribute %d, Value %p, StringLength %d)\n", ConnectionHandle, Attribute,
|
||||
Value, StringLength);
|
||||
--
|
||||
2.43.0
|
||||
|
@ -0,0 +1,87 @@
|
||||
From 3b48c805fbb5deef6aa11b9a31948e60a53916a8 Mon Sep 17 00:00:00 2001
|
||||
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
||||
Date: Wed, 10 Jul 2024 15:17:00 +1000
|
||||
Subject: [PATCH] odbc32: Store handles when requesting information of Columns.
|
||||
|
||||
---
|
||||
dlls/odbc32/proxyodbc.c | 34 +++++++++++++++++++++++++++++++++-
|
||||
dlls/odbc32/unixlib.h | 11 +++++++++++
|
||||
2 files changed, 44 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
|
||||
index 550e7b16be4..c6ee7aac7c6 100644
|
||||
--- a/dlls/odbc32/proxyodbc.c
|
||||
+++ b/dlls/odbc32/proxyodbc.c
|
||||
@@ -4115,7 +4115,39 @@ SQLRETURN WINAPI SQLGetStmtAttrW(SQLHSTMT StatementHandle, SQLINTEGER Attribute,
|
||||
}
|
||||
else if (handle->win32_handle)
|
||||
{
|
||||
- ret = handle->win32_funcs->SQLGetStmtAttrW( handle->win32_handle, Attribute, Value, BufferLength, StringLength );
|
||||
+ switch(Attribute)
|
||||
+ {
|
||||
+ case SQL_ATTR_APP_ROW_DESC:
|
||||
+ handle->app_row_desc.parent = handle;
|
||||
+ ret = handle->win32_funcs->SQLGetStmtAttrW( handle->win32_handle, Attribute,
|
||||
+ &handle->app_row_desc.driver_hdesc,
|
||||
+ BufferLength, StringLength);
|
||||
+ *((SQLHDESC*)Value) = &handle->app_row_desc;
|
||||
+ break;
|
||||
+ case SQL_ATTR_IMP_ROW_DESC:
|
||||
+ handle->imp_row_desc.parent = handle;
|
||||
+ ret = handle->win32_funcs->SQLGetStmtAttrW( handle->win32_handle, Attribute,
|
||||
+ &handle->imp_row_desc.driver_hdesc,
|
||||
+ BufferLength, StringLength);
|
||||
+ *((SQLHDESC*)Value) = &handle->imp_row_desc;
|
||||
+ break;
|
||||
+ case SQL_ATTR_APP_PARAM_DESC:
|
||||
+ handle->app_param_desc.parent = handle;
|
||||
+ ret = handle->win32_funcs->SQLGetStmtAttrW( handle->win32_handle, Attribute,
|
||||
+ &handle->app_param_desc.driver_hdesc,
|
||||
+ BufferLength, StringLength);
|
||||
+ *((SQLHDESC*)Value) = &handle->app_param_desc;
|
||||
+ break;
|
||||
+ case SQL_ATTR_IMP_PARAM_DESC:
|
||||
+ handle->imp_param_desc.parent = handle;
|
||||
+ ret = handle->win32_funcs->SQLGetStmtAttrW( handle->win32_handle, Attribute,
|
||||
+ &handle->imp_param_desc.driver_hdesc,
|
||||
+ BufferLength, StringLength);
|
||||
+ *((SQLHDESC*)Value) = &handle->imp_param_desc;
|
||||
+ break;
|
||||
+ default:
|
||||
+ ret = handle->win32_funcs->SQLGetStmtAttrW( handle->win32_handle, Attribute, Value, BufferLength, StringLength );
|
||||
+ }
|
||||
}
|
||||
|
||||
TRACE("Returning %d\n", ret);
|
||||
diff --git a/dlls/odbc32/unixlib.h b/dlls/odbc32/unixlib.h
|
||||
index 4241d06c892..fc69857c8b7 100644
|
||||
--- a/dlls/odbc32/unixlib.h
|
||||
+++ b/dlls/odbc32/unixlib.h
|
||||
@@ -183,6 +183,12 @@ struct param_binding
|
||||
struct param *param;
|
||||
};
|
||||
|
||||
+struct SQLHDESC_data
|
||||
+{
|
||||
+ struct handle *parent;
|
||||
+ SQLHDESC driver_hdesc;
|
||||
+};
|
||||
+
|
||||
struct handle
|
||||
{
|
||||
/* handles */
|
||||
@@ -194,6 +200,11 @@ struct handle
|
||||
UINT32 env_attr_version;
|
||||
UINT32 con_attr_con_timeout;
|
||||
UINT32 con_attr_login_timeout;
|
||||
+ /* statement parameters */
|
||||
+ struct SQLHDESC_data app_row_desc;
|
||||
+ struct SQLHDESC_data imp_row_desc;
|
||||
+ struct SQLHDESC_data app_param_desc;
|
||||
+ struct SQLHDESC_data imp_param_desc;
|
||||
/* drivers and data sources */
|
||||
UINT32 drivers_idx;
|
||||
void *drivers_key;
|
||||
--
|
||||
2.43.0
|
||||
|
@ -0,0 +1,44 @@
|
||||
From 5b252124f328a2c0c5e2b80b7d1579f08761f00d Mon Sep 17 00:00:00 2001
|
||||
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
||||
Date: Sat, 13 Jul 2024 15:23:10 +1000
|
||||
Subject: [PATCH] odbc32: SQLSetDescFieldW pass correct handle onto driver
|
||||
|
||||
---
|
||||
dlls/odbc32/proxyodbc.c | 7 ++++---
|
||||
1 file changed, 4 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
|
||||
index c6ee7aac7c6..89d2cc29b71 100644
|
||||
--- a/dlls/odbc32/proxyodbc.c
|
||||
+++ b/dlls/odbc32/proxyodbc.c
|
||||
@@ -4095,7 +4095,7 @@ SQLRETURN WINAPI SQLGetStmtAttrW(SQLHSTMT StatementHandle, SQLINTEGER Attribute,
|
||||
SQLINTEGER BufferLength, SQLINTEGER *StringLength)
|
||||
{
|
||||
struct handle *handle = StatementHandle;
|
||||
- SQLRETURN ret = SQL_ERROR;
|
||||
+ SQLRETURN ret = SQL_SUCCESS;
|
||||
|
||||
TRACE("(StatementHandle %p, Attribute %d, Value %p, BufferLength %d, StringLength %p)\n", StatementHandle,
|
||||
Attribute, Value, BufferLength, StringLength);
|
||||
@@ -4975,7 +4975,8 @@ done:
|
||||
SQLRETURN WINAPI SQLSetDescFieldW(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier,
|
||||
SQLPOINTER Value, SQLINTEGER BufferLength)
|
||||
{
|
||||
- struct handle *handle = DescriptorHandle;
|
||||
+ struct SQLHDESC_data *hdesc = DescriptorHandle;
|
||||
+ struct handle *handle = hdesc->parent;
|
||||
SQLRETURN ret = SQL_ERROR;
|
||||
|
||||
TRACE("(DescriptorHandle %p, RecNumber %d, FieldIdentifier %d, Value %p, BufferLength %d)\n", DescriptorHandle,
|
||||
@@ -4991,7 +4992,7 @@ SQLRETURN WINAPI SQLSetDescFieldW(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumb
|
||||
}
|
||||
else if (handle->win32_handle)
|
||||
{
|
||||
- ret = handle->win32_funcs->SQLSetDescFieldW( handle->win32_handle, RecNumber, FieldIdentifier, Value,
|
||||
+ ret = handle->win32_funcs->SQLSetDescFieldW( handle->app_param_desc.driver_hdesc, RecNumber, FieldIdentifier, Value,
|
||||
BufferLength );
|
||||
}
|
||||
|
||||
--
|
||||
2.43.0
|
||||
|
@ -0,0 +1,45 @@
|
||||
From 35dec93c2df3b2a4db6fe63036669ba7ccdd3806 Mon Sep 17 00:00:00 2001
|
||||
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
||||
Date: Sun, 14 Jul 2024 19:02:11 +1000
|
||||
Subject: [PATCH] odbc32: SQLTransact handle NULL EnvironmentHandle
|
||||
|
||||
---
|
||||
dlls/odbc32/proxyodbc.c | 17 ++++++++++++-----
|
||||
1 file changed, 12 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
|
||||
index 89d2cc29b71..30f3d5f34e9 100644
|
||||
--- a/dlls/odbc32/proxyodbc.c
|
||||
+++ b/dlls/odbc32/proxyodbc.c
|
||||
@@ -2655,16 +2655,23 @@ SQLRETURN WINAPI SQLTransact(SQLHENV EnvironmentHandle, SQLHDBC ConnectionHandle
|
||||
TRACE("(EnvironmentHandle %p, ConnectionHandle %p, CompletionType %d)\n", EnvironmentHandle, ConnectionHandle,
|
||||
CompletionType);
|
||||
|
||||
- if (!env || !con) return SQL_INVALID_HANDLE;
|
||||
+ if (!env && !con) return SQL_INVALID_HANDLE;
|
||||
|
||||
- if (env->unix_handle)
|
||||
+ if ( (env && env->unix_handle) || (con && con->unix_handle))
|
||||
{
|
||||
- struct SQLTransact_params params = { env->unix_handle, con->unix_handle, CompletionType };
|
||||
+ struct SQLTransact_params params = { env ? env->unix_handle : 0,
|
||||
+ con ? con->unix_handle : 0, CompletionType };
|
||||
ret = ODBC_CALL( SQLTransact, ¶ms );
|
||||
}
|
||||
- else if (env->win32_handle)
|
||||
+ else if ( (env && env->win32_handle) || (con && con->win32_handle))
|
||||
{
|
||||
- ret = env->win32_funcs->SQLTransact( env->win32_handle, con->win32_handle, CompletionType );
|
||||
+ const struct win32_funcs *win32_funcs = NULL;
|
||||
+
|
||||
+ if (env) win32_funcs = env->win32_funcs;
|
||||
+ else if (con) win32_funcs = con->win32_funcs;
|
||||
+
|
||||
+ ret = win32_funcs->SQLTransact( env ? env->win32_handle : NULL,
|
||||
+ con ? con->win32_handle : NULL, CompletionType );
|
||||
}
|
||||
|
||||
TRACE("Returning %d\n", ret);
|
||||
--
|
||||
2.43.0
|
||||
|
@ -0,0 +1,83 @@
|
||||
From 3a85cd3851edb650d8cac1d4b2275150c8314bdd Mon Sep 17 00:00:00 2001
|
||||
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
||||
Date: Sun, 14 Jul 2024 20:05:13 +1000
|
||||
Subject: [PATCH] odbc32: Support Creating Environment handle with ODBC 2
|
||||
driver
|
||||
|
||||
---
|
||||
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 30f3d5f34e9..f8b68bf44a5 100644
|
||||
--- a/dlls/odbc32/proxyodbc.c
|
||||
+++ b/dlls/odbc32/proxyodbc.c
|
||||
@@ -814,7 +814,7 @@ static int has_suffix( const WCHAR *str, const WCHAR *suffix )
|
||||
|
||||
static SQLRETURN set_env_attr( struct handle *handle, SQLINTEGER attr, SQLPOINTER value, SQLINTEGER len )
|
||||
{
|
||||
- SQLRETURN ret = SQL_ERROR;
|
||||
+ SQLRETURN ret = SQL_SUCCESS;
|
||||
|
||||
if (handle->unix_handle)
|
||||
{
|
||||
@@ -823,7 +823,8 @@ static SQLRETURN set_env_attr( struct handle *handle, SQLINTEGER attr, SQLPOINTE
|
||||
}
|
||||
else if (handle->win32_handle)
|
||||
{
|
||||
- ret = handle->win32_funcs->SQLSetEnvAttr( handle->win32_handle, attr, value, len );
|
||||
+ if (handle->win32_funcs->SQLSetEnvAttr)
|
||||
+ ret = handle->win32_funcs->SQLSetEnvAttr( handle->win32_handle, attr, value, len );
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@@ -848,7 +849,15 @@ static SQLRETURN create_env( struct handle *handle, BOOL is_unix )
|
||||
}
|
||||
else
|
||||
{
|
||||
- if ((ret = handle->win32_funcs->SQLAllocHandle( SQL_HANDLE_ENV, NULL, &handle->win32_handle ))) return ret;
|
||||
+ if (handle->win32_funcs->SQLAllocHandle)
|
||||
+ {
|
||||
+ if ((ret = handle->win32_funcs->SQLAllocHandle( SQL_HANDLE_ENV, NULL, &handle->win32_handle ))) return ret;
|
||||
+ }
|
||||
+ else if(handle->win32_funcs->SQLAllocEnv)
|
||||
+ {
|
||||
+ /* ODBC v2.0 */
|
||||
+ if ((ret = handle->win32_funcs->SQLAllocEnv(&handle->win32_handle ))) return ret;
|
||||
+ }
|
||||
}
|
||||
|
||||
return prepare_env( handle );
|
||||
@@ -856,7 +865,7 @@ static SQLRETURN create_env( struct handle *handle, BOOL is_unix )
|
||||
|
||||
static SQLRETURN set_con_attr( struct handle *handle, SQLINTEGER attr, SQLPOINTER value, SQLINTEGER len )
|
||||
{
|
||||
- SQLRETURN ret = SQL_ERROR;
|
||||
+ SQLRETURN ret = SQL_SUCCESS;
|
||||
|
||||
if (handle->unix_handle)
|
||||
{
|
||||
@@ -904,8 +913,18 @@ static SQLRETURN create_con( struct handle *handle )
|
||||
}
|
||||
else
|
||||
{
|
||||
- if ((ret = handle->win32_funcs->SQLAllocHandle( SQL_HANDLE_DBC, parent->win32_handle, &handle->win32_handle )))
|
||||
- return ret;
|
||||
+ if (handle->win32_funcs->SQLAllocHandle)
|
||||
+ {
|
||||
+ if ((ret = handle->win32_funcs->SQLAllocHandle( SQL_HANDLE_DBC, parent->win32_handle, &handle->win32_handle )))
|
||||
+ return ret;
|
||||
+ }
|
||||
+ else if (handle->win32_funcs->SQLAllocConnect)
|
||||
+ {
|
||||
+ if ((ret = handle->win32_funcs->SQLAllocConnect( parent->win32_handle, &handle->win32_handle )))
|
||||
+ return ret;
|
||||
+ }
|
||||
+ else
|
||||
+ return SQL_ERROR;
|
||||
}
|
||||
|
||||
return prepare_con( handle );
|
||||
--
|
||||
2.43.0
|
||||
|
2
patches/odbc32-fixes/definition
Normal file
2
patches/odbc32-fixes/definition
Normal file
@ -0,0 +1,2 @@
|
||||
Fixes: [54499] Support native ODBC drivers.
|
||||
Disabled: True
|
Loading…
Reference in New Issue
Block a user