Alistair Leslie-Hughes : msado15: Implement _Recordset get/put Bookmark.
Alexandre Julliard
julliard at winehq.org
Fri Mar 26 16:03:30 CDT 2021
Module: wine
Branch: master
Commit: db509cf4fe862ed13beccd0d281b854aa905a45e
URL: https://source.winehq.org/git/wine.git/?a=commit;h=db509cf4fe862ed13beccd0d281b854aa905a45e
Author: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Date: Fri Mar 26 08:09:17 2021 +1100
msado15: Implement _Recordset get/put Bookmark.
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Signed-off-by: Hans Leidekker <hans at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/msado15/recordset.c | 22 ++++++++++++++++++----
dlls/msado15/tests/msado15.c | 17 +++++++++++++++++
2 files changed, 35 insertions(+), 4 deletions(-)
diff --git a/dlls/msado15/recordset.c b/dlls/msado15/recordset.c
index a86936eb037..68d4c22d802 100644
--- a/dlls/msado15/recordset.c
+++ b/dlls/msado15/recordset.c
@@ -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 )
diff --git a/dlls/msado15/tests/msado15.c b/dlls/msado15/tests/msado15.c
index bc9b4a24761..db606f21fab 100644
--- a/dlls/msado15/tests/msado15.c
+++ b/dlls/msado15/tests/msado15.c
@@ -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 );
More information about the wine-cvs
mailing list