Commit 33563cf1 authored by Alistair Leslie-Hughes's avatar Alistair Leslie-Hughes Committed by Alexandre Julliard

msdasql: Add IGetDataSource support to session.

parent bc52edc1
......@@ -37,6 +37,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(msdasql);
struct msdasql_session
{
IUnknown session_iface;
IGetDataSource IGetDataSource_iface;
LONG refs;
};
......@@ -45,6 +46,11 @@ static inline struct msdasql_session *impl_from_IUnknown( IUnknown *iface )
return CONTAINING_RECORD( iface, struct msdasql_session, session_iface );
}
static inline struct msdasql_session *impl_from_IGetDataSource( IGetDataSource *iface )
{
return CONTAINING_RECORD( iface, struct msdasql_session, IGetDataSource_iface );
}
static HRESULT WINAPI session_QueryInterface(IUnknown *iface, REFIID riid, void **ppv)
{
struct msdasql_session *session = impl_from_IUnknown( iface );
......@@ -57,6 +63,11 @@ static HRESULT WINAPI session_QueryInterface(IUnknown *iface, REFIID riid, void
TRACE("(%p)->(IID_IUnknown %p)\n", iface, ppv);
*ppv = &session->session_iface;
}
else if(IsEqualGUID(&IID_IGetDataSource, riid))
{
TRACE("(%p)->(IID_IGetDataSource %p)\n", iface, ppv);
*ppv = &session->IGetDataSource_iface;
}
if(*ppv)
{
......@@ -96,6 +107,41 @@ static const IUnknownVtbl unkfactoryVtbl =
session_Release,
};
HRESULT WINAPI datasource_QueryInterface(IGetDataSource *iface, REFIID riid, void **out)
{
struct msdasql_session *session = impl_from_IGetDataSource( iface );
return IUnknown_QueryInterface(&session->session_iface, riid, out);
}
ULONG WINAPI datasource_AddRef(IGetDataSource *iface)
{
struct msdasql_session *session = impl_from_IGetDataSource( iface );
return IUnknown_AddRef(&session->session_iface);
}
ULONG WINAPI datasource_Release(IGetDataSource *iface)
{
struct msdasql_session *session = impl_from_IGetDataSource( iface );
return IUnknown_Release(&session->session_iface);
}
HRESULT WINAPI datasource_GetDataSource(IGetDataSource *iface, REFIID riid, IUnknown **datasource)
{
struct msdasql_session *session = impl_from_IGetDataSource( iface );
FIXME("%p, %s, %p stub\n", session, debugstr_guid(riid), datasource);
return E_NOTIMPL;
}
static const IGetDataSourceVtbl datasourceVtbl =
{
datasource_QueryInterface,
datasource_AddRef,
datasource_Release,
datasource_GetDataSource
};
HRESULT create_db_session(REFIID riid, void **unk)
{
struct msdasql_session *session;
......@@ -106,6 +152,7 @@ HRESULT create_db_session(REFIID riid, void **unk)
return E_OUTOFMEMORY;
session->session_iface.lpVtbl = &unkfactoryVtbl;
session->IGetDataSource_iface.lpVtbl = &datasourceVtbl;
session->refs = 1;
hr = IUnknown_QueryInterface(&session->session_iface, riid, unk);
......
......@@ -159,6 +159,7 @@ static void test_sessions(void)
IUnknown *session = NULL;
IOpenRowset *openrowset = NULL;
IDBCreateCommand *create_command = NULL;
IGetDataSource *datasource = NULL;
IUnknown *cmd = NULL;
HRESULT hr;
BSTR connect_str;
......@@ -203,6 +204,10 @@ static void test_sessions(void)
hr = IDBCreateSession_CreateSession( dbsession, NULL, &IID_IUnknown, &session );
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = IUnknown_QueryInterface(session, &IID_IGetDataSource, (void**)&datasource);
ok(hr == S_OK, "got 0x%08x\n", hr);
IGetDataSource_Release(datasource);
hr = IUnknown_QueryInterface(session, &IID_IOpenRowset, (void**)&openrowset);
ok(hr == S_OK, "got 0x%08x\n", hr);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment