msado15: Implement _Recordset get_EditMode.

Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alistair Leslie-Hughes 2022-05-03 11:11:53 +10:00 committed by Alexandre Julliard
parent a34669b238
commit d106b3c450
2 changed files with 24 additions and 2 deletions

View File

@ -48,6 +48,7 @@ struct recordset
CursorLocationEnum cursor_location;
CursorTypeEnum cursor_type;
IRowset *row_set;
EditModeEnum editmode;
};
struct fields
@ -1575,8 +1576,14 @@ static HRESULT WINAPI recordset_put_AbsolutePage( _Recordset *iface, PositionEnu
static HRESULT WINAPI recordset_get_EditMode( _Recordset *iface, EditModeEnum *mode )
{
FIXME( "%p, %p\n", iface, mode );
return E_NOTIMPL;
struct recordset *recordset = impl_from_Recordset( iface );
TRACE( "%p, %p\n", iface, mode );
if (recordset->state == adStateClosed) return MAKE_ADO_HRESULT( adErrObjectClosed );
if (recordset->index < 0) return MAKE_ADO_HRESULT( adErrNoCurrentRecord );
*mode = recordset->editmode;
return S_OK;
}
static HRESULT WINAPI recordset_get_Filter( _Recordset *iface, VARIANT *criteria )
@ -2123,6 +2130,7 @@ HRESULT Recordset_create( void **obj )
recordset->cursor_location = adUseServer;
recordset->cursor_type = adOpenForwardOnly;
recordset->row_set = NULL;
recordset->editmode = adEditNone;
*obj = &recordset->Recordset_iface;
TRACE( "returning iface %p\n", *obj );

View File

@ -60,6 +60,7 @@ static void test_Recordset(void)
BSTR name;
HRESULT hr;
VARIANT bookmark;
EditModeEnum editmode;
hr = CoCreateInstance( &CLSID_Recordset, NULL, CLSCTX_INPROC_SERVER, &IID__Recordset, (void **)&recordset );
ok( hr == S_OK, "got %08lx\n", hr );
@ -110,6 +111,10 @@ static void test_Recordset(void)
ok( hr == S_OK, "got %08lx\n", hr );
ok( cursor == adOpenForwardOnly, "got %d\n", cursor );
editmode = -1;
hr = _Recordset_get_EditMode( recordset, &editmode );
ok( hr == MAKE_ADO_HRESULT( adErrObjectClosed ), "got %08lx\n", hr );
VariantInit( &bookmark );
hr = _Recordset_get_Bookmark( recordset, &bookmark );
ok( hr == MAKE_ADO_HRESULT( adErrObjectClosed ), "got %08lx\n", hr );
@ -197,6 +202,10 @@ static void test_Recordset(void)
ok( is_eof( recordset ), "not eof\n" );
ok( is_bof( recordset ), "not bof\n" );
editmode = -1;
hr = _Recordset_get_EditMode( recordset, &editmode );
ok( hr == MAKE_ADO_HRESULT( adErrNoCurrentRecord ), "got %08lx\n", hr );
hr = _Recordset_Open( recordset, missing, missing, adOpenStatic, adLockBatchOptimistic, adCmdUnspecified );
ok( hr == MAKE_ADO_HRESULT( adErrObjectOpen ), "got %08lx\n", hr );
@ -223,6 +232,11 @@ static void test_Recordset(void)
ok( !is_eof( recordset ), "eof\n" );
ok( !is_bof( recordset ), "bof\n" );
editmode = -1;
hr = _Recordset_get_EditMode( recordset, &editmode );
ok( hr == S_OK, "got %08lx\n", hr );
todo_wine ok( editmode == adEditAdd, "got %d\n", editmode );
rec_count = -1;
hr = _Recordset_get_RecordCount( recordset, &rec_count );
ok( hr == S_OK, "got %08lx\n", hr );