From 475824e7097479127067fd83a4ffbbca502e398e Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Thu, 11 Nov 2021 14:52:24 +1100 Subject: [PATCH] msdasql: Implement IRowsetInfo GetProperties. The only way to actually set these properties is via the ICommandProperties interface found on ICommandText(eg rowset->caller). Signed-off-by: Alistair Leslie-Hughes --- dlls/msdasql/session.c | 15 +++++++++++++-- dlls/msdasql/tests/provider.c | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 2 deletions(-) diff --git a/dlls/msdasql/session.c b/dlls/msdasql/session.c index 2c1f193107b..27d952276e5 100644 --- a/dlls/msdasql/session.c +++ b/dlls/msdasql/session.c @@ -905,8 +905,19 @@ static HRESULT WINAPI rowset_info_GetProperties(IRowsetInfo *iface, const ULONG const DBPROPIDSET propertyidsets[], ULONG *out_count, DBPROPSET **propertysets) { struct msdasql_rowset *rowset = impl_from_IRowsetInfo( iface ); - FIXME("%p, %lu, %p, %p, %p\n", rowset, count, propertyidsets, out_count, propertysets); - return E_NOTIMPL; + HRESULT hr; + ICommandProperties *props; + + TRACE("%p, %lu, %p, %p, %p\n", rowset, count, propertyidsets, out_count, propertysets); + + hr = IUnknown_QueryInterface(rowset->caller, &IID_ICommandProperties, (void**)&props); + if (FAILED(hr)) + return hr; + + hr = ICommandProperties_GetProperties(props, count, propertyidsets, out_count, propertysets); + ICommandProperties_Release(props); + + return hr; } static HRESULT WINAPI rowset_info_GetReferencedRowset(IRowsetInfo *iface, DBORDINAL ordinal, diff --git a/dlls/msdasql/tests/provider.c b/dlls/msdasql/tests/provider.c index ec883a80943..72e13154846 100644 --- a/dlls/msdasql/tests/provider.c +++ b/dlls/msdasql/tests/provider.c @@ -496,6 +496,43 @@ static void test_rowset_interfaces(IRowset *rowset, ICommandText *commandtext) ok(hr == E_NOINTERFACE, "got 0x%08lx\n", hr); } +static void test_rowset_info(IRowset *rowset) +{ + IRowsetInfo *info; + HRESULT hr; + ULONG propcnt; + DBPROPIDSET propidset; + DBPROPSET *propset; + int i; + DWORD row_props[] = { + DBPROP_CANSCROLLBACKWARDS, DBPROP_IRowsetUpdate, DBPROP_IRowsetResynch, + DBPROP_IConnectionPointContainer, DBPROP_BOOKMARKSKIPPED, DBPROP_REMOVEDELETED, + DBPROP_IConvertType, DBPROP_NOTIFICATIONGRANULARITY, DBPROP_IMultipleResults, DBPROP_ACCESSORDER, + DBPROP_BOOKMARKINFO, DBPROP_UNIQUEROWS + }; + + hr = IRowset_QueryInterface(rowset, &IID_IRowsetInfo, (void**)&info); + ok(hr == S_OK, "got 0x%08lx\n", hr); + + propidset.rgPropertyIDs = row_props; + propidset.cPropertyIDs = ARRAY_SIZE(row_props); + propidset.guidPropertySet = DBPROPSET_ROWSET; + + hr = IRowsetInfo_GetProperties(info, 1, &propidset, &propcnt, &propset); + ok(hr == S_OK, "got 0x%08lx\n", hr); + ok(propset->cProperties == ARRAY_SIZE(row_props), "got %lu\n", propset->cProperties); + + for(i=0; i < ARRAY_SIZE(row_props); i++) + { + ok(propset->rgProperties[i].dwPropertyID == row_props[i], "expected 0x%08lx got 0x%08lx\n", + propset->rgProperties[i].dwPropertyID, row_props[i]); + } + + CoTaskMemFree(propset); + + IRowsetInfo_Release(info); +} + static void test_command_rowset(IUnknown *cmd) { ICommandText *command_text; @@ -587,6 +624,8 @@ static void test_command_rowset(IUnknown *cmd) CoTaskMemFree(stringsbuffer); IColumnsInfo_Release(colinfo); + test_rowset_info(rowset); + IRowset_Release(rowset); IUnknown_Release(unk); } -- 2.11.4.GIT