Commit 26c4a1ed authored by Alistair Leslie-Hughes's avatar Alistair Leslie-Hughes Committed by Alexandre Julliard

msdasql: Implement IRowsetInfo GetSpecification.

parent ff0f5e40
...@@ -426,6 +426,7 @@ struct msdasql_rowset ...@@ -426,6 +426,7 @@ struct msdasql_rowset
IColumnsInfo IColumnsInfo_iface; IColumnsInfo IColumnsInfo_iface;
IAccessor IAccessor_iface; IAccessor IAccessor_iface;
IColumnsRowset IColumnsRowset_iface; IColumnsRowset IColumnsRowset_iface;
IUnknown *caller;
LONG refs; LONG refs;
}; };
...@@ -524,6 +525,10 @@ static ULONG WINAPI msdasql_rowset_Release(IRowset *iface) ...@@ -524,6 +525,10 @@ static ULONG WINAPI msdasql_rowset_Release(IRowset *iface)
if (!refs) if (!refs)
{ {
TRACE( "destroying %p\n", rowset ); TRACE( "destroying %p\n", rowset );
if (rowset->caller)
IUnknown_Release(rowset->caller);
heap_free( rowset ); heap_free( rowset );
} }
return refs; return refs;
...@@ -618,8 +623,16 @@ static HRESULT WINAPI rowset_info_GetSpecification(IRowsetInfo *iface, REFIID ri ...@@ -618,8 +623,16 @@ static HRESULT WINAPI rowset_info_GetSpecification(IRowsetInfo *iface, REFIID ri
IUnknown **specification) IUnknown **specification)
{ {
struct msdasql_rowset *rowset = impl_from_IRowsetInfo( iface ); 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 = struct IRowsetInfoVtbl rowset_info_vtbl =
...@@ -798,6 +811,7 @@ static HRESULT WINAPI command_Execute(ICommandText *iface, IUnknown *outer, REFI ...@@ -798,6 +811,7 @@ static HRESULT WINAPI command_Execute(ICommandText *iface, IUnknown *outer, REFI
msrowset->IAccessor_iface.lpVtbl = &accessor_vtbl; msrowset->IAccessor_iface.lpVtbl = &accessor_vtbl;
msrowset->IColumnsRowset_iface.lpVtbl = &columnrs_rs_vtbl; msrowset->IColumnsRowset_iface.lpVtbl = &columnrs_rs_vtbl;
msrowset->refs = 1; msrowset->refs = 1;
ICommandText_QueryInterface(iface, &IID_IUnknown, (void**)&msrowset->caller);
if (affected) if (affected)
*affected = 0; /* FIXME */ *affected = 0; /* FIXME */
......
...@@ -293,17 +293,29 @@ static void test_command_dbsession(IUnknown *cmd, IUnknown *session) ...@@ -293,17 +293,29 @@ static void test_command_dbsession(IUnknown *cmd, IUnknown *session)
ICommandText_Release(comand_text); ICommandText_Release(comand_text);
} }
static void test_rowset_interfaces(IRowset *rowset) static void test_rowset_interfaces(IRowset *rowset, ICommandText *commandtext)
{ {
IRowsetInfo *info; IRowsetInfo *info;
IColumnsInfo *col_info; IColumnsInfo *col_info;
IColumnsRowset *col_rs; IColumnsRowset *col_rs;
IAccessor *accessor; IAccessor *accessor;
ICommandText *specification = NULL;
IUnknown *unk; IUnknown *unk;
HRESULT hr; HRESULT hr;
hr = IRowset_QueryInterface(rowset, &IID_IRowsetInfo, (void**)&info); hr = IRowset_QueryInterface(rowset, &IID_IRowsetInfo, (void**)&info);
ok(hr == S_OK, "got 0x%08x\n", hr); 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); IRowsetInfo_Release(info);
hr = IRowset_QueryInterface(rowset, &IID_IColumnsInfo, (void**)&col_info); hr = IRowset_QueryInterface(rowset, &IID_IColumnsInfo, (void**)&col_info);
...@@ -364,7 +376,7 @@ static void test_command_rowset(IUnknown *cmd) ...@@ -364,7 +376,7 @@ static void test_command_rowset(IUnknown *cmd)
hr = IUnknown_QueryInterface(unk, &IID_IRowset, (void**)&rowset); hr = IUnknown_QueryInterface(unk, &IID_IRowset, (void**)&rowset);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "got 0x%08x\n", hr);
test_rowset_interfaces(rowset); test_rowset_interfaces(rowset, comand_text);
IRowset_Release(rowset); IRowset_Release(rowset);
IUnknown_Release(unk); IUnknown_Release(unk);
......
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