From: Alistair Leslie-Hughes leslie_alistair@hotmail.com
Signed-off-by: Alistair Leslie-Hughes leslie_alistair@hotmail.com --- dlls/msado15/recordset.c | 12 ++++++++++-- dlls/msado15/tests/msado15.c | 14 ++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/dlls/msado15/recordset.c b/dlls/msado15/recordset.c index 766c17598ce..6d3b3ca352f 100644 --- a/dlls/msado15/recordset.c +++ b/dlls/msado15/recordset.c @@ -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 ); diff --git a/dlls/msado15/tests/msado15.c b/dlls/msado15/tests/msado15.c index 94e9ae4fa09..b39adf58b22 100644 --- a/dlls/msado15/tests/msado15.c +++ b/dlls/msado15/tests/msado15.c @@ -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 );