Commit 0d29647f authored by Alistair Leslie-Hughes's avatar Alistair Leslie-Hughes Committed by Alexandre Julliard

msdasql: Add ICommandWithParameters to command interface.

parent b2f12a34
...@@ -426,6 +426,7 @@ struct msdasql_rowset ...@@ -426,6 +426,7 @@ struct msdasql_rowset
IColumnsInfo IColumnsInfo_iface; IColumnsInfo IColumnsInfo_iface;
IAccessor IAccessor_iface; IAccessor IAccessor_iface;
IColumnsRowset IColumnsRowset_iface; IColumnsRowset IColumnsRowset_iface;
ICommandWithParameters ICommandWithParameters_iface;
IUnknown *caller; IUnknown *caller;
LONG refs; LONG refs;
}; };
...@@ -455,6 +456,11 @@ static inline struct msdasql_rowset *impl_from_IColumnsRowset ( IColumnsRowset * ...@@ -455,6 +456,11 @@ static inline struct msdasql_rowset *impl_from_IColumnsRowset ( IColumnsRowset *
return CONTAINING_RECORD( iface, struct msdasql_rowset, IColumnsRowset_iface ); 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) static HRESULT WINAPI msdasql_rowset_QueryInterface(IRowset *iface, REFIID riid, void **ppv)
{ {
struct msdasql_rowset *rowset = impl_from_IRowset( iface ); struct msdasql_rowset *rowset = impl_from_IRowset( iface );
...@@ -483,6 +489,10 @@ static HRESULT WINAPI msdasql_rowset_QueryInterface(IRowset *iface, REFIID riid, ...@@ -483,6 +489,10 @@ static HRESULT WINAPI msdasql_rowset_QueryInterface(IRowset *iface, REFIID riid,
{ {
*ppv = &rowset->IColumnsRowset_iface; *ppv = &rowset->IColumnsRowset_iface;
} }
else if(IsEqualGUID(&IID_ICommandWithParameters, riid))
{
*ppv = &rowset->ICommandWithParameters_iface;
}
else if (IsEqualGUID(&IID_IRowsetChange, riid)) else if (IsEqualGUID(&IID_IRowsetChange, riid))
{ {
TRACE("IID_IRowsetChange not supported\n"); TRACE("IID_IRowsetChange not supported\n");
...@@ -791,6 +801,57 @@ struct IColumnsRowsetVtbl columnrs_rs_vtbl = ...@@ -791,6 +801,57 @@ struct IColumnsRowsetVtbl columnrs_rs_vtbl =
column_rs_GetColumnsRowset 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, static HRESULT WINAPI command_Execute(ICommandText *iface, IUnknown *outer, REFIID riid,
DBPARAMS *params, DBROWCOUNT *affected, IUnknown **rowset) DBPARAMS *params, DBROWCOUNT *affected, IUnknown **rowset)
...@@ -810,6 +871,7 @@ static HRESULT WINAPI command_Execute(ICommandText *iface, IUnknown *outer, REFI ...@@ -810,6 +871,7 @@ static HRESULT WINAPI command_Execute(ICommandText *iface, IUnknown *outer, REFI
msrowset->IColumnsInfo_iface.lpVtbl = &rowset_columninfo_vtbll; msrowset->IColumnsInfo_iface.lpVtbl = &rowset_columninfo_vtbll;
msrowset->IAccessor_iface.lpVtbl = &accessor_vtbl; msrowset->IAccessor_iface.lpVtbl = &accessor_vtbl;
msrowset->IColumnsRowset_iface.lpVtbl = &columnrs_rs_vtbl; msrowset->IColumnsRowset_iface.lpVtbl = &columnrs_rs_vtbl;
msrowset->ICommandWithParameters_iface.lpVtbl = &command_with_params_vtbl;
msrowset->refs = 1; msrowset->refs = 1;
ICommandText_QueryInterface(iface, &IID_IUnknown, (void**)&msrowset->caller); ICommandText_QueryInterface(iface, &IID_IUnknown, (void**)&msrowset->caller);
......
...@@ -193,12 +193,17 @@ static void test_command_interfaces(IUnknown *cmd) ...@@ -193,12 +193,17 @@ static void test_command_interfaces(IUnknown *cmd)
ICommandStream *commandstream; ICommandStream *commandstream;
IColumnsInfo *colinfo; IColumnsInfo *colinfo;
IMultipleResults *multiple; IMultipleResults *multiple;
ICommandWithParameters *cmdwithparams;
IUnknown *unk; IUnknown *unk;
hr = IUnknown_QueryInterface(cmd, &IID_ICommandProperties, (void**)&commandProp); hr = IUnknown_QueryInterface(cmd, &IID_ICommandProperties, (void**)&commandProp);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "got 0x%08x\n", hr);
ICommandProperties_Release(commandProp); 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); hr = IUnknown_QueryInterface(cmd, &IID_ICommandText, (void**)&comand_text);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "got 0x%08x\n", hr);
ICommandText_Release(comand_text); ICommandText_Release(comand_text);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment