Commit d5aa6377 authored by Alistair Leslie-Hughes's avatar Alistair Leslie-Hughes Committed by Alexandre Julliard

msado15: Support Properties interface on Field.

parent 57b1b21a
...@@ -184,6 +184,7 @@ static REFIID tid_ids[] = { ...@@ -184,6 +184,7 @@ static REFIID tid_ids[] = {
&IID__Connection, &IID__Connection,
&IID_Field, &IID_Field,
&IID_Fields, &IID_Fields,
&IID_Properties,
&IID__Recordset, &IID__Recordset,
&IID__Stream, &IID__Stream,
}; };
......
...@@ -48,6 +48,7 @@ typedef enum tid_t { ...@@ -48,6 +48,7 @@ typedef enum tid_t {
Connection_tid, Connection_tid,
Field_tid, Field_tid,
Fields_tid, Fields_tid,
Properties_tid,
Recordset_tid, Recordset_tid,
Stream_tid, Stream_tid,
LAST_tid LAST_tid
......
...@@ -65,6 +65,7 @@ struct field ...@@ -65,6 +65,7 @@ struct field
{ {
Field Field_iface; Field Field_iface;
ISupportErrorInfo ISupportErrorInfo_iface; ISupportErrorInfo ISupportErrorInfo_iface;
Properties Properties_iface;
LONG refs; LONG refs;
WCHAR *name; WCHAR *name;
DataTypeEnum type; DataTypeEnum type;
...@@ -79,6 +80,11 @@ static inline struct field *impl_from_Field( Field *iface ) ...@@ -79,6 +80,11 @@ static inline struct field *impl_from_Field( Field *iface )
return CONTAINING_RECORD( iface, struct field, Field_iface ); return CONTAINING_RECORD( iface, struct field, Field_iface );
} }
static inline struct field *impl_from_Properties( Properties *iface )
{
return CONTAINING_RECORD( iface, struct field, Properties_iface );
}
static ULONG WINAPI field_AddRef( Field *iface ) static ULONG WINAPI field_AddRef( Field *iface )
{ {
struct field *field = impl_from_Field( iface ); struct field *field = impl_from_Field( iface );
...@@ -181,8 +187,12 @@ static HRESULT WINAPI field_Invoke( Field *iface, DISPID member, REFIID riid, LC ...@@ -181,8 +187,12 @@ static HRESULT WINAPI field_Invoke( Field *iface, DISPID member, REFIID riid, LC
static HRESULT WINAPI field_get_Properties( Field *iface, Properties **obj ) static HRESULT WINAPI field_get_Properties( Field *iface, Properties **obj )
{ {
FIXME( "%p, %p\n", iface, obj ); struct field *field = impl_from_Field( iface );
return E_NOTIMPL; TRACE( "%p, %p\n", iface, obj );
*obj = &field->Properties_iface;
Properties_AddRef(&field->Properties_iface);
return S_OK;
} }
static HRESULT WINAPI field_get_ActualSize( Field *iface, LONG *size ) static HRESULT WINAPI field_get_ActualSize( Field *iface, LONG *size )
...@@ -447,6 +457,135 @@ static const ISupportErrorInfoVtbl field_supporterrorinfo_vtbl = ...@@ -447,6 +457,135 @@ static const ISupportErrorInfoVtbl field_supporterrorinfo_vtbl =
field_supporterrorinfo_InterfaceSupportsErrorInfo field_supporterrorinfo_InterfaceSupportsErrorInfo
}; };
static HRESULT WINAPI field_props_QueryInterface(Properties *iface, REFIID riid, void **ppv)
{
struct field *field = impl_from_Properties( iface );
if (IsEqualGUID( riid, &IID_Properties) || IsEqualGUID( riid, &IID_IDispatch ) ||
IsEqualGUID( riid, &IID_IUnknown ))
{
*ppv = &field->Properties_iface;
}
else
{
FIXME( "interface %s not implemented\n", debugstr_guid(riid) );
return E_NOINTERFACE;
}
Field_AddRef(&field->Field_iface);
return S_OK;
}
static ULONG WINAPI field_props_AddRef(Properties *iface)
{
struct field *field = impl_from_Properties( iface );
return Field_AddRef(&field->Field_iface);
}
static ULONG WINAPI field_props_Release(Properties *iface)
{
struct field *field = impl_from_Properties( iface );
return Field_Release(&field->Field_iface);
}
static HRESULT WINAPI field_props_GetTypeInfoCount(Properties *iface, UINT *count)
{
struct field *field = impl_from_Properties( iface );
TRACE( "%p, %p\n", field, count );
*count = 1;
return S_OK;
}
static HRESULT WINAPI field_props_GetTypeInfo(Properties *iface, UINT index, LCID lcid, ITypeInfo **info)
{
struct field *field = impl_from_Properties( iface );
TRACE( "%p, %u, %u, %p\n", field, index, lcid, info );
return get_typeinfo(Properties_tid, info);
}
static HRESULT WINAPI field_props_GetIDsOfNames(Properties *iface, REFIID riid, LPOLESTR *names, UINT count,
LCID lcid, DISPID *dispid )
{
struct field *field = impl_from_Properties( iface );
HRESULT hr;
ITypeInfo *typeinfo;
TRACE( "%p, %s, %p, %u, %u, %p\n", field, debugstr_guid(riid), names, count, lcid, dispid );
hr = get_typeinfo(Properties_tid, &typeinfo);
if(SUCCEEDED(hr))
{
hr = ITypeInfo_GetIDsOfNames(typeinfo, names, count, dispid);
ITypeInfo_Release(typeinfo);
}
return hr;
}
static HRESULT WINAPI field_props_Invoke(Properties *iface, DISPID member, REFIID riid, LCID lcid, WORD flags,
DISPPARAMS *params, VARIANT *result, EXCEPINFO *excep_info, UINT *arg_err )
{
struct field *field = impl_from_Properties( iface );
HRESULT hr;
ITypeInfo *typeinfo;
TRACE( "%p, %d, %s, %d, %d, %p, %p, %p, %p\n", field, member, debugstr_guid(riid), lcid, flags, params,
result, excep_info, arg_err );
hr = get_typeinfo(Properties_tid, &typeinfo);
if(SUCCEEDED(hr))
{
hr = ITypeInfo_Invoke(typeinfo, &field->Field_iface, member, flags, params,
result, excep_info, arg_err);
ITypeInfo_Release(typeinfo);
}
return hr;
}
static HRESULT WINAPI field_props_get_Count(Properties *iface, LONG *count)
{
struct field *field = impl_from_Properties( iface );
FIXME( "%p, %p\n", field, count);
*count = 0;
return S_OK;
}
static HRESULT WINAPI field_props__NewEnum(Properties *iface, IUnknown **object)
{
struct field *field = impl_from_Properties( iface );
FIXME( "%p, %p\n", field, object);
return E_NOTIMPL;
}
static HRESULT WINAPI field_props_Refresh(Properties *iface)
{
struct field *field = impl_from_Properties( iface );
FIXME( "%p\n", field);
return E_NOTIMPL;
}
static HRESULT WINAPI field_props_get_Item(Properties *iface, VARIANT index, Property **object)
{
struct field *field = impl_from_Properties( iface );
FIXME( "%p, %s, %p\n", field, debugstr_variant(&index), object);
return MAKE_ADO_HRESULT(adErrItemNotFound);
}
static struct PropertiesVtbl field_properties_vtbl =
{
field_props_QueryInterface,
field_props_AddRef,
field_props_Release,
field_props_GetTypeInfoCount,
field_props_GetTypeInfo,
field_props_GetIDsOfNames,
field_props_Invoke,
field_props_get_Count,
field_props__NewEnum,
field_props_Refresh,
field_props_get_Item
};
static HRESULT Field_create( const WCHAR *name, LONG index, struct recordset *recordset, Field **obj ) static HRESULT Field_create( const WCHAR *name, LONG index, struct recordset *recordset, Field **obj )
{ {
struct field *field; struct field *field;
...@@ -454,6 +593,7 @@ static HRESULT Field_create( const WCHAR *name, LONG index, struct recordset *re ...@@ -454,6 +593,7 @@ static HRESULT Field_create( const WCHAR *name, LONG index, struct recordset *re
if (!(field = heap_alloc_zero( sizeof(*field) ))) return E_OUTOFMEMORY; if (!(field = heap_alloc_zero( sizeof(*field) ))) return E_OUTOFMEMORY;
field->Field_iface.lpVtbl = &field_vtbl; field->Field_iface.lpVtbl = &field_vtbl;
field->ISupportErrorInfo_iface.lpVtbl = &field_supporterrorinfo_vtbl; field->ISupportErrorInfo_iface.lpVtbl = &field_supporterrorinfo_vtbl;
field->Properties_iface.lpVtbl = &field_properties_vtbl;
if (!(field->name = strdupW( name ))) if (!(field->name = strdupW( name )))
{ {
heap_free( field ); heap_free( field );
......
...@@ -68,6 +68,8 @@ static void test_Recordset(void) ...@@ -68,6 +68,8 @@ static void test_Recordset(void)
ISupportErrorInfo *errorinfo; ISupportErrorInfo *errorinfo;
Fields *fields, *fields2; Fields *fields, *fields2;
Field *field; Field *field;
Properties *props;
Property *prop;
LONG refs, count, state; LONG refs, count, state;
VARIANT missing, val, index; VARIANT missing, val, index;
CursorLocationEnum location; CursorLocationEnum location;
...@@ -184,6 +186,24 @@ static void test_Recordset(void) ...@@ -184,6 +186,24 @@ static void test_Recordset(void)
ok( hr == S_OK, "got %08x\n", hr ); ok( hr == S_OK, "got %08x\n", hr );
SysFreeString( name ); SysFreeString( name );
hr = Field_QueryInterface(field, &IID_Properties, (void**)&props);
ok( hr == E_NOINTERFACE, "got %08x\n", hr );
hr = Field_get_Properties(field, &props);
ok( hr == S_OK, "got %08x\n", hr );
count = -1;
hr = Properties_get_Count(props, &count);
ok( hr == S_OK, "got %08x\n", hr );
ok( !count, "got %d\n", count );
V_VT( &index ) = VT_I4;
V_I4( &index ) = 1000;
hr = Properties_get_Item(props, index, &prop);
ok( hr == MAKE_ADO_HRESULT(adErrItemNotFound), "got %08x\n", hr );
Properties_Release(props);
hr = _Recordset_Open( recordset, missing, missing, adOpenStatic, adLockBatchOptimistic, adCmdUnspecified ); hr = _Recordset_Open( recordset, missing, missing, adOpenStatic, adLockBatchOptimistic, adCmdUnspecified );
ok( hr == S_OK, "got %08x\n", hr ); ok( hr == S_OK, "got %08x\n", hr );
ok( is_eof( recordset ), "not eof\n" ); ok( is_eof( recordset ), "not eof\n" );
......
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