Alistair Leslie-Hughes : msdasql: Add IColumnsInfo interface for ICommandText.

Alexandre Julliard julliard at winehq.org
Fri Oct 29 16:29:08 CDT 2021


Module: wine
Branch: master
Commit: d9e0dde2ca99f9a43ce62ed66ce02d47a2998c48
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=d9e0dde2ca99f9a43ce62ed66ce02d47a2998c48

Author: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Date:   Fri Oct 29 17:32:47 2021 +1100

msdasql: Add IColumnsInfo interface for ICommandText.

Signed-off-by: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/msdasql/session.c        | 54 +++++++++++++++++++++++++++++++++++++++++++
 dlls/msdasql/tests/provider.c |  5 ++--
 2 files changed, 56 insertions(+), 3 deletions(-)

diff --git a/dlls/msdasql/session.c b/dlls/msdasql/session.c
index 85e79e00108..eabdcacc968 100644
--- a/dlls/msdasql/session.c
+++ b/dlls/msdasql/session.c
@@ -279,6 +279,7 @@ struct command
 {
     ICommandText ICommandText_iface;
     ICommandProperties ICommandProperties_iface;
+    IColumnsInfo IColumnsInfo_iface;
     LONG refs;
 };
 
@@ -292,6 +293,11 @@ static inline struct command *impl_from_ICommandProperties( ICommandProperties *
     return CONTAINING_RECORD( iface, struct command, ICommandProperties_iface );
 }
 
+static inline struct command *impl_from_IColumnsInfo( IColumnsInfo *iface )
+{
+    return CONTAINING_RECORD( iface, struct command, IColumnsInfo_iface );
+}
+
 static HRESULT WINAPI command_QueryInterface(ICommandText *iface, REFIID riid, void **ppv)
 {
     struct command *command = impl_from_ICommandText( iface );
@@ -309,6 +315,10 @@ static HRESULT WINAPI command_QueryInterface(ICommandText *iface, REFIID riid, v
     {
          *ppv = &command->ICommandProperties_iface;
     }
+    else if(IsEqualGUID(&IID_IColumnsInfo, riid))
+    {
+         *ppv = &command->IColumnsInfo_iface;
+    }
 
     if(*ppv)
     {
@@ -457,6 +467,49 @@ static const ICommandPropertiesVtbl commonpropsVtbl =
     command_prop_SetProperties
 };
 
+static HRESULT WINAPI colsinfo_QueryInterface(IColumnsInfo *iface, REFIID riid, void **out)
+{
+    struct command *command = impl_from_IColumnsInfo( iface );
+    return ICommandText_QueryInterface(&command->ICommandText_iface, riid, out);
+}
+
+static ULONG WINAPI colsinfo_AddRef(IColumnsInfo *iface)
+{
+    struct command *command = impl_from_IColumnsInfo( iface );
+    return ICommandText_AddRef(&command->ICommandText_iface);
+}
+
+static ULONG  WINAPI colsinfo_Release(IColumnsInfo *iface)
+{
+    struct command *command = impl_from_IColumnsInfo( iface );
+    return ICommandText_Release(&command->ICommandText_iface);
+}
+
+static HRESULT WINAPI colsinfo_GetColumnInfo(IColumnsInfo *iface, DBORDINAL *columns,
+        DBCOLUMNINFO **colinfo, OLECHAR **stringsbuffer)
+{
+    struct command *command = impl_from_IColumnsInfo( iface );
+    FIXME("%p, %p, %p, %p\n", command, columns, colinfo, stringsbuffer);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI colsinfo_MapColumnIDs(IColumnsInfo *iface, DBORDINAL column_ids,
+        const DBID *dbids, DBORDINAL *columns)
+{
+    struct command *command = impl_from_IColumnsInfo( iface );
+    FIXME("%p, %lu, %p, %p\n", command, column_ids, dbids, columns);
+    return E_NOTIMPL;
+}
+
+static struct IColumnsInfoVtbl columninfoVtbl =
+{
+    colsinfo_QueryInterface,
+    colsinfo_AddRef,
+    colsinfo_Release,
+    colsinfo_GetColumnInfo,
+    colsinfo_MapColumnIDs
+};
+
 static HRESULT WINAPI createcommand_CreateCommand(IDBCreateCommand *iface, IUnknown *outer, REFIID riid,
                                             IUnknown **out)
 {
@@ -475,6 +528,7 @@ static HRESULT WINAPI createcommand_CreateCommand(IDBCreateCommand *iface, IUnkn
 
     command->ICommandText_iface.lpVtbl = &commandVtbl;
     command->ICommandProperties_iface.lpVtbl = &commonpropsVtbl;
+    command->IColumnsInfo_iface.lpVtbl = &columninfoVtbl;
     command->refs = 1;
 
     hr = ICommandText_QueryInterface(&command->ICommandText_iface, riid, (void**)out);
diff --git a/dlls/msdasql/tests/provider.c b/dlls/msdasql/tests/provider.c
index 184e5d3b1e8..d4c6930bc8e 100644
--- a/dlls/msdasql/tests/provider.c
+++ b/dlls/msdasql/tests/provider.c
@@ -140,9 +140,8 @@ static void test_command_interfaces(IUnknown *cmd)
         ICommandPrepare_Release(commandprepare);
 
     hr = IUnknown_QueryInterface(cmd, &IID_IColumnsInfo, (void**)&colinfo);
-    todo_wine ok(hr == S_OK, "got 0x%08x\n", hr);
-    if (hr == S_OK)
-        IColumnsInfo_Release(colinfo);
+    ok(hr == S_OK, "got 0x%08x\n", hr);
+    IColumnsInfo_Release(colinfo);
 
     hr = IUnknown_QueryInterface(cmd, &IID_ICommandStream, (void**)&commandstream);
     ok(hr == E_NOINTERFACE, "got 0x%08x\n", hr);




More information about the wine-cvs mailing list