[PATCH 5/5] msdasql: Add IConvertType interface for ICommandText

Alistair Leslie-Hughes leslie_alistair at hotmail.com
Fri Oct 29 01:32:48 CDT 2021


Signed-off-by: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
---
 dlls/msdasql/session.c        | 44 +++++++++++++++++++++++++++++++++++
 dlls/msdasql/tests/provider.c |  5 ++--
 2 files changed, 46 insertions(+), 3 deletions(-)

diff --git a/dlls/msdasql/session.c b/dlls/msdasql/session.c
index eabdcacc968..3ee4b72a1d1 100644
--- a/dlls/msdasql/session.c
+++ b/dlls/msdasql/session.c
@@ -280,6 +280,7 @@ struct command
     ICommandText ICommandText_iface;
     ICommandProperties ICommandProperties_iface;
     IColumnsInfo IColumnsInfo_iface;
+    IConvertType IConvertType_iface;
     LONG refs;
 };
 
@@ -298,6 +299,11 @@ static inline struct command *impl_from_IColumnsInfo( IColumnsInfo *iface )
     return CONTAINING_RECORD( iface, struct command, IColumnsInfo_iface );
 }
 
+static inline struct command *impl_from_IConvertType( IConvertType *iface )
+{
+    return CONTAINING_RECORD( iface, struct command, IConvertType_iface );
+}
+
 static HRESULT WINAPI command_QueryInterface(ICommandText *iface, REFIID riid, void **ppv)
 {
     struct command *command = impl_from_ICommandText( iface );
@@ -319,6 +325,10 @@ static HRESULT WINAPI command_QueryInterface(ICommandText *iface, REFIID riid, v
     {
          *ppv = &command->IColumnsInfo_iface;
     }
+    else if(IsEqualGUID(&IID_IConvertType, riid))
+    {
+         *ppv = &command->IConvertType_iface;
+    }
 
     if(*ppv)
     {
@@ -510,6 +520,39 @@ static struct IColumnsInfoVtbl columninfoVtbl =
     colsinfo_MapColumnIDs
 };
 
+static HRESULT WINAPI converttype_QueryInterface(IConvertType *iface, REFIID riid, void **out)
+{
+    struct command *command = impl_from_IConvertType( iface );
+    return ICommandText_QueryInterface(&command->ICommandText_iface, riid, out);
+}
+
+static ULONG WINAPI converttype_AddRef(IConvertType *iface)
+{
+    struct command *command = impl_from_IConvertType( iface );
+    return ICommandText_AddRef(&command->ICommandText_iface);
+}
+
+static ULONG WINAPI converttype_Release(IConvertType *iface)
+{
+    struct command *command = impl_from_IConvertType( iface );
+    return ICommandText_Release(&command->ICommandText_iface);
+}
+
+static HRESULT WINAPI converttype_CanConvert(IConvertType *iface, DBTYPE from, DBTYPE to, DBCONVERTFLAGS flags)
+{
+    struct command *command = impl_from_IConvertType( iface );
+    FIXME("%p, %u, %d, 0x%08x\n", command, from, to, flags);
+    return E_NOTIMPL;
+}
+
+static struct IConvertTypeVtbl converttypeVtbl =
+{
+    converttype_QueryInterface,
+    converttype_AddRef,
+    converttype_Release,
+    converttype_CanConvert
+};
+
 static HRESULT WINAPI createcommand_CreateCommand(IDBCreateCommand *iface, IUnknown *outer, REFIID riid,
                                             IUnknown **out)
 {
@@ -529,6 +572,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->IConvertType_iface.lpVtbl = &converttypeVtbl;
     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 d4c6930bc8e..7d14928e50b 100644
--- a/dlls/msdasql/tests/provider.c
+++ b/dlls/msdasql/tests/provider.c
@@ -130,9 +130,8 @@ static void test_command_interfaces(IUnknown *cmd)
     ICommandText_Release(comand_text);
 
     hr = IUnknown_QueryInterface(cmd, &IID_IConvertType, (void**)&convertype);
-    todo_wine ok(hr == S_OK, "got 0x%08x\n", hr);
-    if (hr == S_OK)
-        IConvertType_Release(convertype);
+    ok(hr == S_OK, "got 0x%08x\n", hr);
+    IConvertType_Release(convertype);
 
     hr = IUnknown_QueryInterface(cmd, &IID_ICommandPrepare, (void**)&commandprepare);
     todo_wine ok(hr == S_OK, "got 0x%08x\n", hr);
-- 
2.33.0




More information about the wine-devel mailing list