[PATCH 2/6] msdasql: Support IRowsetInfo in IRowset interface

Alistair Leslie-Hughes leslie_alistair at hotmail.com
Mon Nov 1 21:21:22 CDT 2021


Signed-off-by: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
---
 dlls/msdasql/session.c        | 63 +++++++++++++++++++++++++++++++++++
 dlls/msdasql/tests/provider.c | 12 +++++++
 2 files changed, 75 insertions(+)

diff --git a/dlls/msdasql/session.c b/dlls/msdasql/session.c
index 6a1e6bb8e0d..85b11670687 100644
--- a/dlls/msdasql/session.c
+++ b/dlls/msdasql/session.c
@@ -412,6 +412,7 @@ static HRESULT WINAPI command_Cancel(ICommandText *iface)
 struct msdasql_rowset
 {
     IRowset IRowset_iface;
+    IRowsetInfo IRowsetInfo_iface;
     LONG refs;
 };
 
@@ -420,6 +421,11 @@ static inline struct msdasql_rowset *impl_from_IRowset( IRowset *iface )
     return CONTAINING_RECORD( iface, struct msdasql_rowset, IRowset_iface );
 }
 
+static inline struct msdasql_rowset *impl_from_IRowsetInfo( IRowsetInfo *iface )
+{
+    return CONTAINING_RECORD( iface, struct msdasql_rowset, IRowsetInfo_iface );
+}
+
 static HRESULT WINAPI msdasql_rowset_QueryInterface(IRowset *iface, REFIID riid,  void **ppv)
 {
     struct msdasql_rowset *rowset = impl_from_IRowset( iface );
@@ -432,6 +438,10 @@ static HRESULT WINAPI msdasql_rowset_QueryInterface(IRowset *iface, REFIID riid,
     {
         *ppv = &rowset->IRowset_iface;
     }
+    else if (IsEqualGUID(&IID_IRowsetInfo, riid))
+    {
+        *ppv = &rowset->IRowsetInfo_iface;
+    }
 
     if(*ppv)
     {
@@ -515,6 +525,58 @@ static const struct IRowsetVtbl msdasql_rowset_vtbl =
     msdasql_rowset_RestartPosition
 };
 
+static HRESULT WINAPI rowset_info_QueryInterface(IRowsetInfo *iface, REFIID riid, void **ppv)
+{
+    struct msdasql_rowset *rowset = impl_from_IRowsetInfo( iface );
+    return IRowset_QueryInterface(&rowset->IRowset_iface, riid, ppv);
+}
+
+static ULONG WINAPI rowset_info_AddRef(IRowsetInfo *iface)
+{
+    struct msdasql_rowset *rowset = impl_from_IRowsetInfo( iface );
+    return IRowset_AddRef(&rowset->IRowset_iface);
+}
+
+static ULONG WINAPI rowset_info_Release(IRowsetInfo *iface)
+{
+    struct msdasql_rowset *rowset = impl_from_IRowsetInfo( iface );
+    return IRowset_Release(&rowset->IRowset_iface);
+}
+
+static HRESULT WINAPI rowset_info_GetProperties(IRowsetInfo *iface, const ULONG count,
+        const DBPROPIDSET propertyidsets[], ULONG *out_count, DBPROPSET **propertysets)
+{
+    struct msdasql_rowset *rowset = impl_from_IRowsetInfo( iface );
+    FIXME("%p, %ld, %p, %p, %p\n", rowset, count, propertyidsets, out_count, propertysets);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI rowset_info_GetReferencedRowset(IRowsetInfo *iface, DBORDINAL ordinal,
+        REFIID riid, IUnknown **unk)
+{
+    struct msdasql_rowset *rowset = impl_from_IRowsetInfo( iface );
+    FIXME("%p, %ld, %s, %p\n", rowset, ordinal, debugstr_guid(riid), unk);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI rowset_info_GetSpecification(IRowsetInfo *iface, REFIID riid,
+        IUnknown **specification)
+{
+    struct msdasql_rowset *rowset = impl_from_IRowsetInfo( iface );
+    FIXME("%p, %s, %p\n", rowset, debugstr_guid(riid), specification);
+    return E_NOTIMPL;
+}
+
+struct IRowsetInfoVtbl rowset_info_vtbl =
+{
+    rowset_info_QueryInterface,
+    rowset_info_AddRef,
+    rowset_info_Release,
+    rowset_info_GetProperties,
+    rowset_info_GetReferencedRowset,
+    rowset_info_GetSpecification
+};
+
 static HRESULT WINAPI command_Execute(ICommandText *iface, IUnknown *outer, REFIID riid,
         DBPARAMS *params, DBROWCOUNT *affected, IUnknown **rowset)
 {
@@ -529,6 +591,7 @@ static HRESULT WINAPI command_Execute(ICommandText *iface, IUnknown *outer, REFI
         return E_OUTOFMEMORY;
 
     msrowset->IRowset_iface.lpVtbl = &msdasql_rowset_vtbl;
+    msrowset->IRowsetInfo_iface.lpVtbl = &rowset_info_vtbl;
     msrowset->refs = 1;
 
     if (affected)
diff --git a/dlls/msdasql/tests/provider.c b/dlls/msdasql/tests/provider.c
index 8b8d8e4b494..604815b1ee5 100644
--- a/dlls/msdasql/tests/provider.c
+++ b/dlls/msdasql/tests/provider.c
@@ -222,6 +222,16 @@ static void test_command_dbsession(IUnknown *cmd, IUnknown *session)
     ICommandText_Release(comand_text);
 }
 
+static void test_rowset_interfaces(IRowset *rowset)
+{
+    IRowsetInfo *info;
+    HRESULT hr;
+
+    hr = IRowset_QueryInterface(rowset, &IID_IRowsetInfo, (void**)&info);
+    ok(hr == S_OK, "got 0x%08x\n", hr);
+    IRowsetInfo_Release(info);
+}
+
 static void test_command_rowset(IUnknown *cmd)
 {
     ICommandText *comand_text;
@@ -258,6 +268,8 @@ 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);
+
         IRowset_Release(rowset);
         IUnknown_Release(unk);
     }
-- 
2.33.0




More information about the wine-devel mailing list