Signed-off-by: Alistair Leslie-Hughes leslie_alistair@hotmail.com --- dlls/msdasql/session.c | 18 ++++++++++++++++-- dlls/msdasql/tests/provider.c | 16 ++++++++++++++-- 2 files changed, 30 insertions(+), 4 deletions(-)
diff --git a/dlls/msdasql/session.c b/dlls/msdasql/session.c index 6e9c4b680e9..7c5e102c122 100644 --- a/dlls/msdasql/session.c +++ b/dlls/msdasql/session.c @@ -426,6 +426,7 @@ struct msdasql_rowset IColumnsInfo IColumnsInfo_iface; IAccessor IAccessor_iface; IColumnsRowset IColumnsRowset_iface; + IUnknown *caller; LONG refs; };
@@ -524,6 +525,10 @@ static ULONG WINAPI msdasql_rowset_Release(IRowset *iface) if (!refs) { TRACE( "destroying %p\n", rowset ); + + if (rowset->caller) + IUnknown_Release(rowset->caller); + heap_free( rowset ); } return refs; @@ -618,8 +623,16 @@ static HRESULT WINAPI rowset_info_GetSpecification(IRowsetInfo *iface, REFIID ri IUnknown **specification) { struct msdasql_rowset *rowset = impl_from_IRowsetInfo( iface ); - FIXME("%p, %s, %p\n", rowset, debugstr_guid(riid), specification); - return E_NOTIMPL; + + TRACE("%p, %s, %p\n", rowset, debugstr_guid(riid), specification); + + if (!specification) + return E_INVALIDARG; + + if (!rowset->caller) + return S_FALSE; + + return IUnknown_QueryInterface(rowset->caller, riid, (void**)specification);; }
struct IRowsetInfoVtbl rowset_info_vtbl = @@ -798,6 +811,7 @@ static HRESULT WINAPI command_Execute(ICommandText *iface, IUnknown *outer, REFI msrowset->IAccessor_iface.lpVtbl = &accessor_vtbl; msrowset->IColumnsRowset_iface.lpVtbl = &columnrs_rs_vtbl; msrowset->refs = 1; + ICommandText_QueryInterface(iface, &IID_IUnknown, (void**)&msrowset->caller);
if (affected) *affected = 0; /* FIXME */ diff --git a/dlls/msdasql/tests/provider.c b/dlls/msdasql/tests/provider.c index 353e2ec58c8..b0e13b72589 100644 --- a/dlls/msdasql/tests/provider.c +++ b/dlls/msdasql/tests/provider.c @@ -293,17 +293,29 @@ static void test_command_dbsession(IUnknown *cmd, IUnknown *session) ICommandText_Release(comand_text); }
-static void test_rowset_interfaces(IRowset *rowset) +static void test_rowset_interfaces(IRowset *rowset, ICommandText *commandtext) { IRowsetInfo *info; IColumnsInfo *col_info; IColumnsRowset *col_rs; IAccessor *accessor; + ICommandText *specification = NULL; IUnknown *unk; HRESULT hr;
hr = IRowset_QueryInterface(rowset, &IID_IRowsetInfo, (void**)&info); ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = IRowsetInfo_GetSpecification(info, &IID_ICommandText, NULL); + ok(hr == E_INVALIDARG, "got 0x%08x\n", hr); + + hr = IRowsetInfo_GetSpecification(info, &IID_ICommandText, (IUnknown**)&specification); + ok(hr == S_OK, "got 0x%08x\n", hr); + if (specification) + { + ok(commandtext == specification, "got 0x%08x\n", hr); + ICommandText_Release(specification); + } IRowsetInfo_Release(info);
hr = IRowset_QueryInterface(rowset, &IID_IColumnsInfo, (void**)&col_info); @@ -364,7 +376,7 @@ static void test_command_rowset(IUnknown *cmd) hr = IUnknown_QueryInterface(unk, &IID_IRowset, (void**)&rowset); ok(hr == S_OK, "got 0x%08x\n", hr);
- test_rowset_interfaces(rowset); + test_rowset_interfaces(rowset, comand_text);
IRowset_Release(rowset); IUnknown_Release(unk);