Commit 6255b031 authored by Aaro Altonen's avatar Aaro Altonen Committed by Alexandre Julliard

msado15: Implement _Command get/put CommandType.

parent 1ae10889
......@@ -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;
......
......@@ -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 );
}
......
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