msado15: Implement _Recordset get/put Bookmark.

Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alistair Leslie-Hughes 2021-03-26 08:09:17 +11:00 committed by Alexandre Julliard
parent 25f5734ead
commit db509cf4fe
2 changed files with 35 additions and 4 deletions

View File

@ -1029,14 +1029,28 @@ static HRESULT WINAPI recordset_get_BOF( _Recordset *iface, VARIANT_BOOL *bof )
static HRESULT WINAPI recordset_get_Bookmark( _Recordset *iface, VARIANT *bookmark )
{
FIXME( "%p, %p\n", iface, bookmark );
return E_NOTIMPL;
struct recordset *recordset = impl_from_Recordset( iface );
TRACE( "%p, %p\n", iface, bookmark );
if (recordset->state == adStateClosed) return MAKE_ADO_HRESULT( adErrObjectClosed );
if (recordset->index < 0) return MAKE_ADO_HRESULT( adErrNoCurrentRecord );
V_VT(bookmark) = VT_I4;
V_I4(bookmark) = recordset->index;
return S_OK;
}
static HRESULT WINAPI recordset_put_Bookmark( _Recordset *iface, VARIANT bookmark )
{
FIXME( "%p, %s\n", iface, debugstr_variant(&bookmark) );
return E_NOTIMPL;
struct recordset *recordset = impl_from_Recordset( iface );
TRACE( "%p, %s\n", iface, debugstr_variant(&bookmark) );
if (recordset->state == adStateClosed) return MAKE_ADO_HRESULT( adErrObjectClosed );
if (V_VT(&bookmark) != VT_I4) return MAKE_ADO_HRESULT( adErrInvalidArgument );
recordset->index = V_I4(&bookmark);
return S_OK;
}
static HRESULT WINAPI recordset_get_CacheSize( _Recordset *iface, LONG *size )

View File

@ -74,6 +74,7 @@ static void test_Recordset(void)
CursorTypeEnum cursor;
BSTR name;
HRESULT hr;
VARIANT bookmark;
hr = CoCreateInstance( &CLSID_Recordset, NULL, CLSCTX_INPROC_SERVER, &IID__Recordset, (void **)&recordset );
ok( hr == S_OK, "got %08x\n", hr );
@ -153,6 +154,14 @@ static void test_Recordset(void)
ok( hr == S_OK, "got %08x\n", hr );
ok( cursor == adOpenForwardOnly, "got %d\n", cursor );
VariantInit( &bookmark );
hr = _Recordset_get_Bookmark( recordset, &bookmark );
ok( hr == MAKE_ADO_HRESULT( adErrObjectClosed ), "got %08x\n", hr );
VariantInit( &bookmark );
hr = _Recordset_put_Bookmark( recordset, bookmark );
ok( hr == MAKE_ADO_HRESULT( adErrObjectClosed ), "got %08x\n", hr );
VariantInit( &missing );
hr = _Recordset_AddNew( recordset, missing, missing );
ok( hr == MAKE_ADO_HRESULT( adErrObjectClosed ), "got %08x\n", hr );
@ -188,6 +197,14 @@ static void test_Recordset(void)
ok( hr == S_OK, "got %08x\n", hr );
ok( state == adStateOpen, "got %d\n", state );
VariantInit( &bookmark );
hr = _Recordset_get_Bookmark( recordset, &bookmark );
ok( hr == MAKE_ADO_HRESULT( adErrNoCurrentRecord ), "got %08x\n", hr );
VariantInit( &bookmark );
hr = _Recordset_put_Bookmark( recordset, bookmark );
ok( hr == MAKE_ADO_HRESULT( adErrInvalidArgument ), "got %08x\n", hr );
count = -1;
hr = _Recordset_get_RecordCount( recordset, &count );
ok( hr == S_OK, "got %08x\n", hr );