msado15: Implement _Connection Get/Put Provider.
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com> Signed-off-by: Hans Leidekker <hans@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
d136c7554c
commit
2262e04827
|
@ -53,6 +53,7 @@ struct connection
|
||||||
ObjectStateEnum state;
|
ObjectStateEnum state;
|
||||||
LONG timeout;
|
LONG timeout;
|
||||||
WCHAR *datasource;
|
WCHAR *datasource;
|
||||||
|
WCHAR *provider;
|
||||||
struct connection_point cp_connev;
|
struct connection_point cp_connev;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -96,6 +97,7 @@ static ULONG WINAPI connection_Release( _Connection *iface )
|
||||||
IUnknown_Release( connection->cp_connev.sinks[i] );
|
IUnknown_Release( connection->cp_connev.sinks[i] );
|
||||||
}
|
}
|
||||||
heap_free( connection->cp_connev.sinks );
|
heap_free( connection->cp_connev.sinks );
|
||||||
|
heap_free( connection->provider );
|
||||||
heap_free( connection->datasource );
|
heap_free( connection->datasource );
|
||||||
heap_free( connection );
|
heap_free( connection );
|
||||||
}
|
}
|
||||||
|
@ -346,14 +348,29 @@ static HRESULT WINAPI connection_put_Mode( _Connection *iface, ConnectModeEnum m
|
||||||
|
|
||||||
static HRESULT WINAPI connection_get_Provider( _Connection *iface, BSTR *str )
|
static HRESULT WINAPI connection_get_Provider( _Connection *iface, BSTR *str )
|
||||||
{
|
{
|
||||||
FIXME( "%p, %p\n", iface, str );
|
struct connection *connection = impl_from_Connection( iface );
|
||||||
return E_NOTIMPL;
|
BSTR provider = NULL;
|
||||||
|
|
||||||
|
TRACE( "%p, %p\n", iface, str );
|
||||||
|
|
||||||
|
if (connection->provider && !(provider = SysAllocString( connection->provider ))) return E_OUTOFMEMORY;
|
||||||
|
*str = provider;
|
||||||
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI connection_put_Provider( _Connection *iface, BSTR str )
|
static HRESULT WINAPI connection_put_Provider( _Connection *iface, BSTR str )
|
||||||
{
|
{
|
||||||
FIXME( "%p, %s\n", iface, debugstr_w(str) );
|
struct connection *connection = impl_from_Connection( iface );
|
||||||
return E_NOTIMPL;
|
WCHAR *provider = NULL;
|
||||||
|
|
||||||
|
TRACE( "%p, %s\n", iface, debugstr_w(str) );
|
||||||
|
|
||||||
|
if (!str) return MAKE_ADO_HRESULT(adErrInvalidArgument);
|
||||||
|
|
||||||
|
if (!(provider = strdupW( str ))) return E_OUTOFMEMORY;
|
||||||
|
heap_free( connection->provider );
|
||||||
|
connection->provider = provider;
|
||||||
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI connection_get_State( _Connection *iface, LONG *state )
|
static HRESULT WINAPI connection_get_State( _Connection *iface, LONG *state )
|
||||||
|
@ -646,6 +663,7 @@ HRESULT Connection_create( void **obj )
|
||||||
connection->state = adStateClosed;
|
connection->state = adStateClosed;
|
||||||
connection->timeout = 30;
|
connection->timeout = 30;
|
||||||
connection->datasource = NULL;
|
connection->datasource = NULL;
|
||||||
|
connection->provider = SysAllocString(L"MSDASQL");
|
||||||
|
|
||||||
connection->cp_connev.conn = connection;
|
connection->cp_connev.conn = connection;
|
||||||
connection->cp_connev.riid = &DIID_ConnectionEvents;
|
connection->cp_connev.riid = &DIID_ConnectionEvents;
|
||||||
|
|
|
@ -718,15 +718,50 @@ if (0) /* Crashes on windows */
|
||||||
ok(hr == S_OK, "Failed to get state, hr 0x%08x\n", hr);
|
ok(hr == S_OK, "Failed to get state, hr 0x%08x\n", hr);
|
||||||
ok(timeout == 300, "Unexpected timeout value %d\n", timeout);
|
ok(timeout == 300, "Unexpected timeout value %d\n", timeout);
|
||||||
|
|
||||||
|
/* Default */
|
||||||
|
str = (BSTR)0xdeadbeef;
|
||||||
|
hr = _Connection_get_Provider(connection, &str);
|
||||||
|
ok(hr == S_OK, "Failed, hr 0x%08x\n", hr);
|
||||||
|
ok(!wcscmp(str, L"MSDASQL"), "wrong string %s\n", wine_dbgstr_w(str));
|
||||||
|
SysFreeString(str);
|
||||||
|
|
||||||
|
str = SysAllocString(L"MSDASQL.1");
|
||||||
|
hr = _Connection_put_Provider(connection, str);
|
||||||
|
ok(hr == S_OK, "Failed, hr 0x%08x\n", hr);
|
||||||
|
SysFreeString(str);
|
||||||
|
|
||||||
|
str = (BSTR)0xdeadbeef;
|
||||||
|
hr = _Connection_get_Provider(connection, &str);
|
||||||
|
ok(hr == S_OK, "Failed, hr 0x%08x\n", hr);
|
||||||
|
ok(!wcscmp(str, L"MSDASQL.1"), "wrong string %s\n", wine_dbgstr_w(str));
|
||||||
|
|
||||||
|
/* Restore default */
|
||||||
|
str = SysAllocString(L"MSDASQL");
|
||||||
|
hr = _Connection_put_Provider(connection, str);
|
||||||
|
ok(hr == S_OK, "Failed, hr 0x%08x\n", hr);
|
||||||
|
SysFreeString(str);
|
||||||
|
|
||||||
|
hr = _Connection_put_Provider(connection, NULL);
|
||||||
|
ok(hr == MAKE_ADO_HRESULT(adErrInvalidArgument), "got 0x%08x\n", hr);
|
||||||
|
SysFreeString(str);
|
||||||
|
|
||||||
str = (BSTR)0xdeadbeef;
|
str = (BSTR)0xdeadbeef;
|
||||||
hr = _Connection_get_ConnectionString(connection, &str);
|
hr = _Connection_get_ConnectionString(connection, &str);
|
||||||
ok(hr == S_OK, "Failed, hr 0x%08x\n", hr);
|
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||||
ok(str == NULL, "got %p\n", str);
|
ok(str == NULL, "got %p\n", str);
|
||||||
|
|
||||||
str = SysAllocString(L"Provider=MSDASQL.1;Persist Security Info=False;Data Source=wine_test");
|
str = SysAllocString(L"Provider=MSDASQL.1;Persist Security Info=False;Data Source=wine_test");
|
||||||
hr = _Connection_put_ConnectionString(connection, str);
|
hr = _Connection_put_ConnectionString(connection, str);
|
||||||
ok(hr == S_OK, "Failed, hr 0x%08x\n", hr);
|
ok(hr == S_OK, "Failed, hr 0x%08x\n", hr);
|
||||||
|
|
||||||
|
/* Show put_ConnectionString effects Provider */
|
||||||
|
str3 = (BSTR)0xdeadbeef;
|
||||||
|
hr = _Connection_get_Provider(connection, &str3);
|
||||||
|
ok(hr == S_OK, "Failed, hr 0x%08x\n", hr);
|
||||||
|
ok(str3 != NULL, "Expected value got NULL\n");
|
||||||
|
todo_wine ok(!wcscmp(str3, L"MSDASQL.1"), "wrong string %s\n", wine_dbgstr_w(str3));
|
||||||
|
SysFreeString(str3);
|
||||||
|
|
||||||
if (0) /* Crashes on windows */
|
if (0) /* Crashes on windows */
|
||||||
{
|
{
|
||||||
hr = _Connection_get_ConnectionString(connection, NULL);
|
hr = _Connection_get_ConnectionString(connection, NULL);
|
||||||
|
|
Loading…
Reference in New Issue