Signed-off-by: Alistair Leslie-Hughes leslie_alistair@hotmail.com --- dlls/msdasql/session.c | 62 +++++++++++++++++++++++++++++++++++ dlls/msdasql/tests/provider.c | 5 +++ 2 files changed, 67 insertions(+)
diff --git a/dlls/msdasql/session.c b/dlls/msdasql/session.c index 82693115b8a..3829f8f946f 100644 --- a/dlls/msdasql/session.c +++ b/dlls/msdasql/session.c @@ -426,6 +426,7 @@ struct msdasql_rowset IColumnsInfo IColumnsInfo_iface; IAccessor IAccessor_iface; IColumnsRowset IColumnsRowset_iface; + ICommandWithParameters ICommandWithParameters_iface; IUnknown *caller; LONG refs; }; @@ -455,6 +456,11 @@ static inline struct msdasql_rowset *impl_from_IColumnsRowset ( IColumnsRowset * return CONTAINING_RECORD( iface, struct msdasql_rowset, IColumnsRowset_iface ); }
+static inline struct msdasql_rowset *impl_from_ICommandWithParameters( ICommandWithParameters *iface ) +{ + return CONTAINING_RECORD( iface, struct msdasql_rowset, ICommandWithParameters_iface ); +} + static HRESULT WINAPI msdasql_rowset_QueryInterface(IRowset *iface, REFIID riid, void **ppv) { struct msdasql_rowset *rowset = impl_from_IRowset( iface ); @@ -483,6 +489,10 @@ static HRESULT WINAPI msdasql_rowset_QueryInterface(IRowset *iface, REFIID riid, { *ppv = &rowset->IColumnsRowset_iface; } + else if(IsEqualGUID(&IID_ICommandWithParameters, riid)) + { + *ppv = &rowset->ICommandWithParameters_iface; + } else if (IsEqualGUID(&IID_IRowsetChange, riid)) { TRACE("IID_IRowsetChange not supported\n"); @@ -791,6 +801,57 @@ struct IColumnsRowsetVtbl columnrs_rs_vtbl = column_rs_GetColumnsRowset };
+static HRESULT WINAPI cmd_with_params_QueryInterface(ICommandWithParameters *iface, REFIID riid, void **out) +{ + struct msdasql_rowset *rowset = impl_from_ICommandWithParameters( iface ); + return IRowset_QueryInterface(&rowset->IRowset_iface, riid, out); +} + +static ULONG WINAPI cmd_with_params_AddRef(ICommandWithParameters *iface) +{ + struct msdasql_rowset *rowset = impl_from_ICommandWithParameters( iface ); + return IRowset_AddRef(&rowset->IRowset_iface); +} + +static ULONG WINAPI cmd_with_params_Release(ICommandWithParameters *iface) +{ + struct msdasql_rowset *rowset = impl_from_ICommandWithParameters( iface ); + return IRowset_Release(&rowset->IRowset_iface); +} + +static HRESULT WINAPI cmd_with_params_GetParameterInfo(ICommandWithParameters *iface, DB_UPARAMS *uparams, + DBPARAMINFO **info, OLECHAR **buffer) +{ + struct msdasql_rowset *rowset = impl_from_ICommandWithParameters( iface ); + FIXME("%p, %p, %p, %p\n", rowset, uparams, info, buffer); + return E_NOTIMPL; +} + +static HRESULT WINAPI cmd_with_params_MapParameterNames(ICommandWithParameters *iface, DB_UPARAMS uparams, + LPCWSTR names[], DB_LPARAMS ordinals[]) +{ + struct msdasql_rowset *rowset = impl_from_ICommandWithParameters( iface ); + FIXME("%p, %ld, %p, %p\n", rowset, uparams, names, ordinals); + return E_NOTIMPL; +} + +static HRESULT WINAPI cmd_with_params_SetParameterInfo(ICommandWithParameters *iface, DB_UPARAMS uparams, + const DB_UPARAMS ordinals[], const DBPARAMBINDINFO bindinfo[]) +{ + struct msdasql_rowset *rowset = impl_from_ICommandWithParameters( iface ); + FIXME("%p, %ld, %p, %p\n", rowset, uparams, ordinals, bindinfo); + return E_NOTIMPL; +} + +struct ICommandWithParametersVtbl command_with_params_vtbl = +{ + cmd_with_params_QueryInterface, + cmd_with_params_AddRef, + cmd_with_params_Release, + cmd_with_params_GetParameterInfo, + cmd_with_params_MapParameterNames, + cmd_with_params_SetParameterInfo +};
static HRESULT WINAPI command_Execute(ICommandText *iface, IUnknown *outer, REFIID riid, DBPARAMS *params, DBROWCOUNT *affected, IUnknown **rowset) @@ -810,6 +871,7 @@ static HRESULT WINAPI command_Execute(ICommandText *iface, IUnknown *outer, REFI msrowset->IColumnsInfo_iface.lpVtbl = &rowset_columninfo_vtbll; msrowset->IAccessor_iface.lpVtbl = &accessor_vtbl; msrowset->IColumnsRowset_iface.lpVtbl = &columnrs_rs_vtbl; + msrowset->ICommandWithParameters_iface.lpVtbl = &command_with_params_vtbl; msrowset->refs = 1; ICommandText_QueryInterface(iface, &IID_IUnknown, (void**)&msrowset->caller);
diff --git a/dlls/msdasql/tests/provider.c b/dlls/msdasql/tests/provider.c index b0e13b72589..37230be04cb 100644 --- a/dlls/msdasql/tests/provider.c +++ b/dlls/msdasql/tests/provider.c @@ -193,12 +193,17 @@ static void test_command_interfaces(IUnknown *cmd) ICommandStream *commandstream; IColumnsInfo *colinfo; IMultipleResults *multiple; + ICommandWithParameters *cmdwithparams; IUnknown *unk;
hr = IUnknown_QueryInterface(cmd, &IID_ICommandProperties, (void**)&commandProp); ok(hr == S_OK, "got 0x%08x\n", hr); ICommandProperties_Release(commandProp);
+ hr = IUnknown_QueryInterface(cmd, &IID_ICommandWithParameters, (void**)&cmdwithparams); + ok(hr == S_OK, "got 0x%08x\n", hr); + ICommandWithParameters_Release(cmdwithparams); + hr = IUnknown_QueryInterface(cmd, &IID_ICommandText, (void**)&comand_text); ok(hr == S_OK, "got 0x%08x\n", hr); ICommandText_Release(comand_text);