msado15: Implement Fields_get_Count.

Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
stable
Hans Leidekker 2019-12-11 17:18:28 +01:00 committed by Alexandre Julliard
parent 0e897cb53e
commit a5939587c9
2 changed files with 52 additions and 4 deletions

View File

@ -388,8 +388,12 @@ static HRESULT WINAPI fields_Invoke( Fields *iface, DISPID member, REFIID riid,
static HRESULT WINAPI fields_get_Count( Fields *iface, LONG *count )
{
FIXME( "%p, %p\n", iface, count );
return E_NOTIMPL;
struct fields *fields = impl_from_Fields( iface );
TRACE( "%p, %p\n", fields, count );
*count = fields->count;
return S_OK;
}
static HRESULT WINAPI fields__NewEnum( Fields *iface, IUnknown **obj )

View File

@ -77,8 +77,8 @@ static void test_Recordset(void)
count = -1;
hr = Fields_get_Count( fields2, &count );
todo_wine ok( hr == S_OK, "got %08x\n", hr );
todo_wine ok( !count, "got %d\n", count );
ok( hr == S_OK, "got %08x\n", hr );
ok( !count, "got %d\n", count );
refs = _Recordset_Release( recordset );
ok( !refs, "got %d\n", refs );
@ -88,6 +88,49 @@ static void test_Recordset(void)
ok( refs == 1, "got %d\n", refs );
}
static void test_Fields(void)
{
_Recordset *recordset;
Fields *fields;
VARIANT val;
BSTR name;
LONG count;
HRESULT hr;
hr = CoCreateInstance( &CLSID_Recordset, NULL, CLSCTX_INPROC_SERVER, &IID__Recordset, (void **)&recordset );
ok( hr == S_OK, "got %08x\n", hr );
hr = _Recordset_get_Fields( recordset, &fields );
ok( hr == S_OK, "got %08x\n", hr );
count = -1;
hr = Fields_get_Count( fields, &count );
ok( !count, "got %d\n", count );
name = SysAllocString( L"field" );
V_VT( &val ) = VT_ERROR;
V_ERROR( &val ) = DISP_E_PARAMNOTFOUND;
hr = Fields_Append( fields, name, adInteger, 4, adFldUnspecified, val );
ok( hr == S_OK, "got %08x\n", hr );
SysFreeString( name );
count = -1;
hr = Fields_get_Count( fields, &count );
ok( count == 1, "got %d\n", count );
name = SysAllocString( L"field2" );
hr = Fields__Append( fields, name, adInteger, 4, adFldUnspecified );
ok( hr == S_OK, "got %08x\n", hr );
SysFreeString( name );
count = -1;
hr = Fields_get_Count( fields, &count );
ok( count == 2, "got %d\n", count );
Fields_Release( fields );
_Recordset_Release( recordset );
}
static HRESULT str_to_byte_array( const char *data, VARIANT *ret )
{
SAFEARRAY *vector;
@ -406,6 +449,7 @@ START_TEST(msado15)
{
CoInitialize( NULL );
test_Connection();
test_Fields();
test_Recordset();
test_Stream();
CoUninitialize();