diff --git a/dlls/msado15/recordset.c b/dlls/msado15/recordset.c index ed3cdf6bbf8..99d22e4db05 100644 --- a/dlls/msado15/recordset.c +++ b/dlls/msado15/recordset.c @@ -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 ) diff --git a/dlls/msado15/tests/msado15.c b/dlls/msado15/tests/msado15.c index e6371b83928..4ef4762ac6a 100644 --- a/dlls/msado15/tests/msado15.c +++ b/dlls/msado15/tests/msado15.c @@ -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();