Rebase against 8070ed27bc4bb8c9c43c20734d340b62b379fcfc.

This commit is contained in:
Alistair Leslie-Hughes 2024-07-16 09:23:21 +10:00
parent 6bab3a7617
commit 67a860f344
6 changed files with 84 additions and 99 deletions

View File

@ -1,4 +1,4 @@
From 9a04cd1f7199385e7521fd77f1118682e50192cf Mon Sep 17 00:00:00 2001
From 630f3a7724e39207f00bcf8a82d5b32acf4d4d21 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
@ -8,10 +8,10 @@ Subject: [PATCH] odbc32: Support Driver in connection string
1 file changed, 74 insertions(+), 23 deletions(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
index 9a4f08440ea..c19d401168b 100644
index 4043c20177b..1cf06658808 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -753,11 +753,20 @@ static WCHAR *strdupAW( const char *src )
@@ -789,11 +789,20 @@ static WCHAR *strdupAW( const char *src )
return dst;
}
@ -34,7 +34,7 @@ index 9a4f08440ea..c19d401168b 100644
return NULL;
}
@@ -771,12 +780,12 @@ static WCHAR *get_reg_value( HKEY key, const WCHAR *name )
@@ -807,12 +816,12 @@ static WCHAR *get_reg_value( HKEY key, const WCHAR *name )
return NULL;
}
@ -49,7 +49,7 @@ index 9a4f08440ea..c19d401168b 100644
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 )
@@ -821,7 +830,7 @@ static WCHAR *get_driver_filename( const SQLWCHAR *source )
RegCloseKey( key_root );
if (ret) return ret;
@ -58,7 +58,7 @@ index 9a4f08440ea..c19d401168b 100644
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
@@ -954,7 +963,7 @@ SQLRETURN WINAPI SQLConnect(SQLHDBC ConnectionHandle, SQLCHAR *ServerName, SQLSM
if (!handle) return SQL_INVALID_HANDLE;
@ -67,8 +67,8 @@ index 9a4f08440ea..c19d401168b 100644
{
WARN( "can't find driver filename\n" );
goto done;
@@ -2650,6 +2659,32 @@ static WCHAR *get_datasource( const WCHAR *connection_string )
return ret;
@@ -2766,6 +2775,32 @@ static SQLRETURN browse_connect_unix_a( struct handle *handle, SQLCHAR *in_conn_
return ODBC_CALL( SQLBrowseConnect, &params );
}
+static WCHAR *get_driver( const WCHAR *connection_string )
@ -100,15 +100,15 @@ index 9a4f08440ea..c19d401168b 100644
/*************************************************************************
* SQLBrowseConnect [ODBC32.055]
*/
@@ -2659,6 +2694,7 @@ SQLRETURN WINAPI SQLBrowseConnect(SQLHDBC ConnectionHandle, SQLCHAR *InConnectio
@@ -2775,6 +2810,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
"StringLength2 %p)\n", ConnectionHandle, debugstr_sqlstr(InConnectionString, StringLength1),
@@ -2782,13 +2818,16 @@ SQLRETURN WINAPI SQLBrowseConnect(SQLHDBC ConnectionHandle, SQLCHAR *InConnectio
if (!handle) return SQL_INVALID_HANDLE;
@ -129,15 +129,15 @@ index 9a4f08440ea..c19d401168b 100644
{
WARN( "can't find driver filename\n" );
goto done;
@@ -3319,6 +3358,7 @@ SQLRETURN WINAPI SQLDriverConnect(SQLHDBC ConnectionHandle, SQLHWND WindowHandle
@@ -3505,6 +3544,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
TRACE("(ConnectionHandle %p, WindowHandle %p, InConnectionString %s, Length %d, OutConnectionString %p,"
" BufferLength %d, Length2 %p, DriverCompletion %d)\n", ConnectionHandle, WindowHandle,
@@ -3513,13 +3553,16 @@ SQLRETURN WINAPI SQLDriverConnect(SQLHDBC ConnectionHandle, SQLHWND WindowHandle
if (!handle) return SQL_INVALID_HANDLE;
@ -158,7 +158,7 @@ index 9a4f08440ea..c19d401168b 100644
{
WARN( "can't find driver filename\n" );
goto done;
@@ -3490,7 +3533,7 @@ SQLRETURN WINAPI SQLConnectW(SQLHDBC ConnectionHandle, WCHAR *ServerName, SQLSMA
@@ -3702,7 +3745,7 @@ SQLRETURN WINAPI SQLConnectW(SQLHDBC ConnectionHandle, WCHAR *ServerName, SQLSMA
if (!handle) return SQL_INVALID_HANDLE;
@ -167,7 +167,7 @@ index 9a4f08440ea..c19d401168b 100644
{
WARN( "can't find driver filename\n" );
goto done;
@@ -4056,6 +4099,7 @@ SQLRETURN WINAPI SQLDriverConnectW(SQLHDBC ConnectionHandle, SQLHWND WindowHandl
@@ -4327,6 +4370,7 @@ SQLRETURN WINAPI SQLDriverConnectW(SQLHDBC ConnectionHandle, SQLHWND WindowHandl
struct handle *handle = ConnectionHandle;
WCHAR *datasource, *filename = NULL;
SQLRETURN ret = SQL_ERROR;
@ -175,7 +175,7 @@ index 9a4f08440ea..c19d401168b 100644
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
@@ -4335,13 +4379,16 @@ SQLRETURN WINAPI SQLDriverConnectW(SQLHDBC ConnectionHandle, SQLHWND WindowHandl
if (!handle) return SQL_INVALID_HANDLE;
@ -196,15 +196,15 @@ index 9a4f08440ea..c19d401168b 100644
{
WARN( "can't find driver filename\n" );
goto done;
@@ -4346,6 +4393,7 @@ SQLRETURN WINAPI SQLBrowseConnectW(SQLHDBC ConnectionHandle, SQLWCHAR *InConnect
@@ -4633,6 +4680,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
"StringLength2 %p)\n", ConnectionHandle, debugstr_sqlwstr(InConnectionString, StringLength1), StringLength1,
@@ -4640,13 +4688,16 @@ SQLRETURN WINAPI SQLBrowseConnectW(SQLHDBC ConnectionHandle, SQLWCHAR *InConnect
if (!handle) return SQL_INVALID_HANDLE;

View File

@ -1,17 +1,17 @@
From a9f272e877306607e502a268cb232609f56eed85 Mon Sep 17 00:00:00 2001
From 1c08cf741851d3f774a64fa905586053748564a6 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(-)
dlls/odbc32/proxyodbc.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
index c19d401168b..3ccb331a6be 100644
index b6913ae2624..c729733750a 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -3758,6 +3758,21 @@ SQLRETURN WINAPI SQLSetCursorNameW(SQLHSTMT StatementHandle, WCHAR *CursorName,
@@ -3989,6 +3989,21 @@ static SQLRETURN col_attribute_unix_w( struct handle *handle, SQLUSMALLINT col,
return ret;
}
@ -30,29 +30,24 @@ index c19d401168b..3ccb331a6be 100644
+ }
+}
+
/*************************************************************************
* 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);
static SQLRETURN col_attribute_win32_w( struct handle *handle, SQLUSMALLINT col, SQLUSMALLINT field_id,
SQLPOINTER char_attr, SQLSMALLINT buflen, SQLSMALLINT *retlen,
SQLLEN *num_attr )
@@ -3996,6 +4011,14 @@ static SQLRETURN col_attribute_win32_w( struct handle *handle, SQLUSMALLINT col,
if (handle->win32_funcs->SQLColAttributeW)
return handle->win32_funcs->SQLColAttributeW( handle->win32_handle, col, field_id, char_attr, buflen,
retlen, num_attr );
+ else if(handle->win32_funcs->SQLColAttributesW)
+ {
+ /* ODBC v2 */
+ field_id = map_odbc3_to_2(field_id);
+ return handle->win32_funcs->SQLColAttributesW( handle->win32_handle, col, field_id,
+ char_attr, buflen, retlen,
+ num_attr );
+ }
if (handle->win32_funcs->SQLColAttribute) FIXME( "Unicode to ANSI conversion not handled\n" );
return SQL_ERROR;
}
--
2.43.0

View File

@ -1,27 +1,23 @@
From e934286dc1be469392c92cbca9d862d33edfd9e7 Mon Sep 17 00:00:00 2001
From aef32555c4c66db02760335f30ca060f83c7df9c 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(-)
dlls/odbc32/proxyodbc.c | 29 ++++++++++++++++++++++++++++-
1 file changed, 28 insertions(+), 1 deletion(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
index 31a789b26a4..e955c5f86f7 100644
index 7c34d905154..53c2cdb4362 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -1807,8 +1807,23 @@ SQLRETURN WINAPI SQLGetDiagRec(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMAL
@@ -1872,7 +1872,21 @@ 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)
- ret = get_diag_rec_win32_a( HandleType, handle, RecNumber, SqlState, NativeError, MessageText, BufferLength,
+ /* ODBC v2.0 */
+ if (handle->win32_funcs->SQLError)
+ {
+ if (HandleType == SQL_HANDLE_ENV)
+ ret = handle->win32_funcs->SQLError(handle->win32_handle, SQL_NULL_HDBC, SQL_NULL_HSTMT,
@ -33,36 +29,31 @@ index 31a789b26a4..e955c5f86f7 100644
+ ret = handle->win32_funcs->SQLError(SQL_NULL_HENV, SQL_NULL_HDBC, handle->win32_handle,
+ SqlState, NativeError, MessageText, BufferLength, TextLength);
+ }
+ else
+ ret = get_diag_rec_win32_a( HandleType, handle, RecNumber, 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);
@@ -4228,6 +4242,19 @@ static SQLRETURN get_diag_rec_win32_w( SQLSMALLINT handle_type, struct handle *h
if (handle->win32_funcs->SQLGetDiagRecW)
return handle->win32_funcs->SQLGetDiagRecW( handle_type, handle->win32_handle, rec_num, state, native_err,
msg, buflen, retlen );
+ else if (handle->win32_funcs->SQLErrorW)
+ {
+ /* ODBC v2 */
+ if (handle_type == SQL_HANDLE_ENV)
+ return handle->win32_funcs->SQLErrorW(handle->win32_handle, SQL_NULL_HDBC, SQL_NULL_HSTMT,
+ state, native_err, msg, buflen, retlen);
+ else if (handle_type == SQL_HANDLE_DBC)
+ return handle->win32_funcs->SQLErrorW(SQL_NULL_HENV, handle->win32_handle, SQL_NULL_HSTMT,
+ state, native_err, msg, buflen, retlen);
+ else if (handle_type == SQL_HANDLE_STMT)
+ return handle->win32_funcs->SQLErrorW(SQL_NULL_HENV, SQL_NULL_HDBC, handle->win32_handle,
+ state, native_err, msg, buflen, retlen);
+ }
if (handle->win32_funcs->SQLGetDiagRec) FIXME( "Unicode to ANSI conversion not handled\n" );
return SQL_ERROR;
}
--
2.43.0

View File

@ -1,4 +1,4 @@
From 55817c84c2be5c143788b820d5cdf37e7eee3199 Mon Sep 17 00:00:00 2001
From 42067e027dac84d160c869564f5c7dbafe9fe657 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
@ -8,17 +8,17 @@ Subject: [PATCH] odbc32: Load function pointer for SQLBindParam
1 file changed, 2 insertions(+)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
index e955c5f86f7..d218efb9545 100644
index 53c2cdb4362..3d900e7ac17 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,
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*);
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 )

View File

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

View File

@ -1 +1 @@
e8f936c745b24f794b36a0af794086e0f57c8551
8070ed27bc4bb8c9c43c20734d340b62b379fcfc