msado15: Implement _Recordset::get_ActiveConnection.

This commit is contained in:
Alistair Leslie-Hughes 2023-09-27 17:57:38 +10:00 committed by Alexandre Julliard
parent e06780c3a7
commit a1610861ff
2 changed files with 19 additions and 3 deletions

View file

@ -39,6 +39,7 @@ struct recordset
ADORecordsetConstruction ADORecordsetConstruction_iface;
ISupportErrorInfo ISupportErrorInfo_iface;
LONG refs;
VARIANT active_connection;
LONG state;
struct fields *fields;
LONG count;
@ -1401,8 +1402,9 @@ static HRESULT WINAPI recordset_put_ActiveConnection( _Recordset *iface, VARIANT
static HRESULT WINAPI recordset_get_ActiveConnection( _Recordset *iface, VARIANT *connection )
{
FIXME( "%p, %p\n", iface, connection );
return E_NOTIMPL;
struct recordset *recordset = impl_from_Recordset( iface );
TRACE( "%p, %p\n", iface, connection );
return VariantCopy(connection, &recordset->active_connection);
}
static HRESULT WINAPI recordset_get_BOF( _Recordset *iface, VARIANT_BOOL *bof )
@ -2737,6 +2739,8 @@ HRESULT Recordset_create( void **obj )
recordset->Recordset_iface.lpVtbl = &recordset_vtbl;
recordset->ISupportErrorInfo_iface.lpVtbl = &recordset_supporterrorinfo_vtbl;
recordset->ADORecordsetConstruction_iface.lpVtbl = &rsconstruction_vtbl;
V_VT(&recordset->active_connection) = VT_DISPATCH;
V_DISPATCH(&recordset->active_connection) = NULL;
recordset->refs = 1;
recordset->index = -1;
recordset->cursor_location = adUseServer;

View file

@ -59,7 +59,7 @@ static void test_Recordset(void)
CursorTypeEnum cursor;
BSTR name;
HRESULT hr;
VARIANT bookmark, filter;
VARIANT bookmark, filter, active;
EditModeEnum editmode;
hr = CoCreateInstance( &CLSID_Recordset, NULL, CLSCTX_INPROC_SERVER, &IID__Recordset, (void **)&recordset );
@ -222,6 +222,18 @@ static void test_Recordset(void)
ok( is_eof( recordset ), "not eof\n" );
ok( is_bof( recordset ), "not bof\n" );
if (0)
{ /* Causes a crash */
hr = _Recordset_get_ActiveConnection( recordset, NULL );
}
VariantInit(&active);
hr = _Recordset_get_ActiveConnection( recordset, &active );
ok( hr == S_OK, "got %08lx\n", hr );
ok( V_VT(&active) == VT_DISPATCH, "got %d\n", V_VT(&active) );
ok( V_DISPATCH(&active) == NULL, "got %p\n", V_DISPATCH(&active) );
VariantClear(&active);
editmode = -1;
hr = _Recordset_get_EditMode( recordset, &editmode );
ok( hr == MAKE_ADO_HRESULT( adErrNoCurrentRecord ), "got %08lx\n", hr );