From: Hans Leidekker hans@codeweavers.com
--- dlls/odbc32/proxyodbc.c | 19 ++++++------------- dlls/odbc32/tests/odbc32.c | 2 +- 2 files changed, 7 insertions(+), 14 deletions(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c index bbb0e1702ae..42267ddc1bb 100644 --- a/dlls/odbc32/proxyodbc.c +++ b/dlls/odbc32/proxyodbc.c @@ -4273,17 +4273,10 @@ static SQLRETURN parse_connect_string( struct attribute_list *list, const WCHAR return SQL_SUCCESS; }
-static const WCHAR *get_datasource( const struct attribute_list *list ) +static const WCHAR *get_attribute( const struct attribute_list *list, const WCHAR *name ) { UINT32 i; - for (i = 0; i < list->count; i++) if (!wcscmp( list->attrs[i]->name, L"DSN" )) return list->attrs[i]->value; - return NULL; -} - -static WCHAR *get_drivername( const struct attribute_list *list ) -{ - UINT32 i; - for (i = 0; i < list->count; i++) if (!wcscmp( list->attrs[i]->name, L"DRIVER" )) return list->attrs[i]->value; + for (i = 0; i < list->count; i++) if (!wcsicmp( list->attrs[i]->name, name )) return list->attrs[i]->value; return NULL; }
@@ -4373,7 +4366,7 @@ SQLRETURN WINAPI SQLBrowseConnect(SQLHDBC ConnectionHandle, SQLCHAR *InConnectio if (parse_connect_string( &attrs, strW ) || !(connect_string = build_connect_string( &attrs )) || !(strA = (SQLCHAR *)strdupWA( connect_string ))) goto done;
- if (!(datasource = get_datasource( &attrs )) && !(drivername = get_drivername( &attrs ))) + if (!(datasource = get_attribute( &attrs, L"DSN" )) && !(drivername = get_attribute( &attrs, L"DRIVER" ))) { WARN( "can't find data source or driver name\n" ); goto done; @@ -5497,7 +5490,7 @@ SQLRETURN WINAPI SQLDriverConnect(SQLHDBC ConnectionHandle, SQLHWND WindowHandle if (parse_connect_string( &attrs, strW ) || !(connect_string = build_connect_string( &attrs )) || !(strA = (SQLCHAR *)strdupWA( connect_string ))) goto done;
- if (!(datasource = get_datasource( &attrs )) && !(drivername = get_drivername( &attrs ))) + if (!(datasource = get_attribute( &attrs, L"DSN" )) && !(drivername = get_attribute( &attrs, L"DRIVER" ))) { WARN( "can't find data source or driver name\n" ); goto done; @@ -6608,7 +6601,7 @@ SQLRETURN WINAPI SQLDriverConnectW(SQLHDBC ConnectionHandle, SQLHWND WindowHandl if (parse_connect_string( &attrs, InConnectionString ) || !(connect_string = build_connect_string( &attrs ))) goto done;
- if (!(datasource = get_datasource( &attrs )) && !(drivername = get_drivername( &attrs ))) + if (!(datasource = get_attribute( &attrs, L"DSN" )) && !(drivername = get_attribute( &attrs, L"DRIVER" ))) { WARN( "can't find data source or driver name\n" ); goto done; @@ -7040,7 +7033,7 @@ SQLRETURN WINAPI SQLBrowseConnectW(SQLHDBC ConnectionHandle, SQLWCHAR *InConnect if (parse_connect_string( &attrs, InConnectionString ) || !(connect_string = build_connect_string( &attrs ))) goto done;
- if (!(datasource = get_datasource( &attrs )) && !(drivername = get_drivername( &attrs ))) + if (!(datasource = get_attribute( &attrs, L"DSN" )) && !(drivername = get_attribute( &attrs, L"DRIVER" ))) { WARN( "can't find data source or driver name\n" ); goto done; diff --git a/dlls/odbc32/tests/odbc32.c b/dlls/odbc32/tests/odbc32.c index 343220771f1..9ef119c205a 100644 --- a/dlls/odbc32/tests/odbc32.c +++ b/dlls/odbc32/tests/odbc32.c @@ -182,7 +182,7 @@ static void test_SQLDriverConnect( void )
len = 0; str[0] = 0; - ret = SQLDriverConnect( con, NULL, (SQLCHAR *)"DSN=winetest;UID=winetest", strlen("DSN=winetest;UID=winetest"), + ret = SQLDriverConnect( con, NULL, (SQLCHAR *)"dsn=winetest;UID=winetest", strlen("dsn=winetest;UID=winetest"), str, sizeof(str), &len, 0 ); if (ret == SQL_ERROR) diag( con, SQL_HANDLE_DBC ); if (ret != SQL_SUCCESS)