msado15: Implement _Command get/put CommandType.

Signed-off-by: Aaro Altonen <a.altonen@hotmail.com>
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Aaro Altonen 2020-05-25 17:01:30 +03:00 committed by Alexandre Julliard
parent 1ae1088964
commit 6255b031af
2 changed files with 41 additions and 6 deletions

View File

@ -31,8 +31,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(msado15);
struct command
{
_Command Command_iface;
LONG ref;
_Command Command_iface;
LONG ref;
CommandTypeEnum type;
};
static inline struct command *impl_from_Command( _Command *iface )
@ -193,14 +194,34 @@ static HRESULT WINAPI command_get_Parameters( _Command *iface, Parameters **para
static HRESULT WINAPI command_put_CommandType( _Command *iface, CommandTypeEnum type )
{
FIXME( "%p, %d\n", iface, type );
return E_NOTIMPL;
struct command *command = impl_from_Command( iface );
TRACE( "%p, %d\n", iface, type );
switch (type)
{
case adCmdUnspecified:
case adCmdUnknown:
case adCmdText:
case adCmdTable:
case adCmdStoredProc:
case adCmdFile:
case adCmdTableDirect:
command->type = type;
return S_OK;
}
return MAKE_ADO_HRESULT( adErrInvalidArgument );
}
static HRESULT WINAPI command_get_CommandType( _Command *iface, CommandTypeEnum *type )
{
FIXME( "%p, %p\n", iface, type );
return E_NOTIMPL;
struct command *command = impl_from_Command( iface );
TRACE( "%p, %p\n", iface, type );
*type = command->type;
return S_OK;
}
static HRESULT WINAPI command_get_Name(_Command *iface, BSTR *name)
@ -305,6 +326,7 @@ HRESULT Command_create( void **obj )
if (!(command = heap_alloc( sizeof(*command) ))) return E_OUTOFMEMORY;
command->Command_iface.lpVtbl = &command_vtbl;
command->type = adCmdUnknown;
command->ref = 1;
*obj = &command->Command_iface;

View File

@ -742,6 +742,7 @@ static void test_Command(void)
_ADO *ado;
Command15 *command15;
Command25 *command25;
CommandTypeEnum cmd_type = adCmdUnspecified;
hr = CoCreateInstance( &CLSID_Command, NULL, CLSCTX_INPROC_SERVER, &IID__Command, (void **)&command );
ok( hr == S_OK, "got %08x\n", hr );
@ -758,6 +759,18 @@ static void test_Command(void)
ok( hr == S_OK, "got %08x\n", hr );
Command25_Release( command25 );
hr = _Command_get_CommandType( command, &cmd_type );
ok( hr == S_OK, "got %08x\n", hr );
ok( cmd_type == adCmdUnknown, "got %08x\n", cmd_type );
_Command_put_CommandType( command, adCmdText );
hr = _Command_get_CommandType( command, &cmd_type );
ok( hr == S_OK, "got %08x\n", hr );
ok( cmd_type == adCmdText, "got %08x\n", cmd_type );
hr = _Command_put_CommandType( command, 0xdeadbeef );
ok( hr == MAKE_ADO_HRESULT( adErrInvalidArgument ), "got %08x\n", hr );
_Command_Release( command );
}