Commit a5939587 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

msado15: Implement Fields_get_Count.

parent 0e897cb5
...@@ -388,8 +388,12 @@ static HRESULT WINAPI fields_Invoke( Fields *iface, DISPID member, REFIID riid, ...@@ -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 ) static HRESULT WINAPI fields_get_Count( Fields *iface, LONG *count )
{ {
FIXME( "%p, %p\n", iface, count ); struct fields *fields = impl_from_Fields( iface );
return E_NOTIMPL;
TRACE( "%p, %p\n", fields, count );
*count = fields->count;
return S_OK;
} }
static HRESULT WINAPI fields__NewEnum( Fields *iface, IUnknown **obj ) static HRESULT WINAPI fields__NewEnum( Fields *iface, IUnknown **obj )
......
...@@ -77,8 +77,8 @@ static void test_Recordset(void) ...@@ -77,8 +77,8 @@ static void test_Recordset(void)
count = -1; count = -1;
hr = Fields_get_Count( fields2, &count ); hr = Fields_get_Count( fields2, &count );
todo_wine ok( hr == S_OK, "got %08x\n", hr ); ok( hr == S_OK, "got %08x\n", hr );
todo_wine ok( !count, "got %d\n", count ); ok( !count, "got %d\n", count );
refs = _Recordset_Release( recordset ); refs = _Recordset_Release( recordset );
ok( !refs, "got %d\n", refs ); ok( !refs, "got %d\n", refs );
...@@ -88,6 +88,49 @@ static void test_Recordset(void) ...@@ -88,6 +88,49 @@ static void test_Recordset(void)
ok( refs == 1, "got %d\n", refs ); 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 ) static HRESULT str_to_byte_array( const char *data, VARIANT *ret )
{ {
SAFEARRAY *vector; SAFEARRAY *vector;
...@@ -406,6 +449,7 @@ START_TEST(msado15) ...@@ -406,6 +449,7 @@ START_TEST(msado15)
{ {
CoInitialize( NULL ); CoInitialize( NULL );
test_Connection(); test_Connection();
test_Fields();
test_Recordset(); test_Recordset();
test_Stream(); test_Stream();
CoUninitialize(); CoUninitialize();
......
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